Replies: 7 comments 4 replies
-
Here's an example: |
Beta Was this translation helpful? Give feedback.
-
I think it could make sense to have a export default defineConfig({
integrations: [sitemap({
separator: '_' // or ''
})]
}) |
Beta Was this translation helpful? Give feedback.
-
Why not provide a way to specify the entire pattern or define a pure function that generates the filename? export default defineConfig({
integrations: [
sitemap({
filename: "sitemap{index}.xml",
}),
],
}); or export default defineConfig({
integrations: [
sitemap({
filename({ index }) {
return `sitemap${index}.xml`;
},
}),
],
}); In both cases, the integration can expect a type of |
Beta Was this translation helpful? Give feedback.
-
@adaliszk Should we allow the main sitemap file to be named differently than the index generated files? base file: |
Beta Was this translation helpful? Give feedback.
-
So this is what I am thinking now which should cover all use-cases. Let me know your thoughts @adaliszk @florian-lefebvre. import sitemap from "@astrojs/sitemap";
export default defineConfig({
integrations: [
sitemap({
// NOTE: new support for no dashes
// omit the extension, it will always be .xml
baseFilename: "sitemap",
// base name, we omit .xml as they always have to be that
filename: async ({ index, baseFilename }}) => {
return baseFilename + index; // sitemap1.xml, sitemap2.xml, etc
},
// // NOTE: backwards compat which we can keep as default so no breaking changes?
// // omit the extension, it will always be .xml
// baseFilename: "sitemap-index",
// // base name, we omit .xml as they always have to be that
// filename: async ({ index, baseFilename }}) => {
// return `sitemap-${index}`; // this will be sitemap-1.xml, sitemap-2.xml, etc
// },
}),
],
}); |
Beta Was this translation helpful? Give feedback.
-
Another thing that might be relevant here is how to handle two domains and one static app. ie. @RhysSullivan do you know what’s the typical way to do this? my guess is dynamic robots.txt and sitemap 😳. |
Beta Was this translation helpful? Give feedback.
-
Good work on this thus far @Hacksore. I am currently rebuilding a site from Eleventy to Astro. The existing site uses Thanks |
Beta Was this translation helpful? Give feedback.
-
Summary
The following places there is a hardcoded dash
-
so we should allow a way to opt-out of that for the SEO best practices.https://github.com/withastro/astro/blob/ff8004f6a7b2aab4c6ac367f13744a341c3c5462/packages/integrations/sitemap/src/index.ts#L47
https://github.com/withastro/astro/blob/ff8004f6a7b2aab4c6ac367f13744a341c3c5462/packages/integrations/sitemap/src/write-sitemap.ts#L42
Background & Motivation
Someone told me so it's bad practice to have hyphens/dashes and it can yield a site map to no load.
https://www.seroundtable.com/google-sitemaps-error-with-hyphenated-file-names-36829.html#:~:text=Google%20might%20be%20having%20some,will%20not%20trigger%20any%20errors.
Goals
A concise, bulleted-list outlining the intended goals of this RFC.
Example
pseudo codeish for how It could work?
Beta Was this translation helpful? Give feedback.
All reactions