-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Next Sitemap Config] Missing <loc>https://www.bytebase.com</loc>
in the generated sitemap
#192
Comments
(Ongoing PR...) |
<loc>Missing bytebase.com</loc>
in the generated sitemap<loc>bytebase.com</loc>
in the generated sitemap
Hmmm, actually, I think I've messed up my fix proposal. Here is a new one: // next-sitemap.config.js
// * ...
const DEFAULT_LANGUAGE = 'en';
// * ...
transform: (config, path) => {
const defaultLanguageNeedle = '/' + DEFAULT_LANGUAGE;
const defaultLanguageEnvelopeNeedle = defaultLanguageNeedle + '/';
const defaultLanguageNeedleLen = defaultLanguageNeedle.length;
if (path.startsWith(defaultLanguageEnvelopeNeedle)) {
path = path.substring(defaultLanguageNeedleLen);
} else if (path === defaultLanguageNeedle) {
path = '/';
}
// * ...
}
I think also that it is safer to check whether the path starts with |
Sorry, as I'm a complete beginner, I've made a lot of mistakes and I've had to edit my PR commit and my messages too many times. It's OK now. 'night! |
<loc>bytebase.com</loc>
in the generated sitemap<loc>bytebase.com</loc>
in the generated sitemap
<loc>bytebase.com</loc>
in the generated sitemap<loc>bytebase.com</loc>
in the generated sitemap
<loc>bytebase.com</loc>
in the generated sitemap<loc>https://bytebase.com</loc>
in the generated sitemap
<loc>https://bytebase.com</loc>
in the generated sitemap<loc>https://www.bytebase.com</loc>
in the generated sitemap
Hello.
I noticed that
<loc>https://www.bytebase.com</loc>
is missing in the generated sitemap.CTRL+F
https://www.bytebase.com<
https://www.bytebase.com/sitemap-0.xml
In this PR:
#190
And more specifically, in this commit:
28fa929
You should beware of your custom transformation.
If your homepage is served at
https://www.bytebase.com/en
, then rewrittenhttps://www.bytebase.com
, you're currently losing it in your generated Sitemap with this transformation. (Because'/en'.substring(3)
is equal to''
.)Here is a proposal of fix:
Also, I think we can get rid off the
async
function expression since theawait
operator isn't used yet in thetransform
function.⬆️ (Still valid suggestion, unlike the code snippet just above.)
Cheers!
The text was updated successfully, but these errors were encountered: