-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add a config option for filenames generated by the @astrojs/sitemap integration #13753
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
Add a config option for filenames generated by the @astrojs/sitemap integration #13753
Conversation
🦋 Changeset detectedLatest commit: d0cb2a6 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature seems reasonable, simple enough and easy to understand. Thank you also for sending a PR to docs. I will ask docs to review the docs PR, in the meantime can you review the changeset?
.changeset/neat-tigers-float.md
Outdated
| '@astrojs/sitemap': minor | ||
| --- | ||
|
|
||
| Allow configuring sitemap filenames generated by `@astro/sitemap` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changesets are meant to document and show new features. In your case, you want to explicitly discuss the new feature you're adding, why it was added, and how users can use it (code snippet). It's a minimal version of the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, @ematipico. 🙂 I gave it a try in d0cb2a6, and will be happy to incorporate further review!
…ntegration (withastro#13753) * Allow configuring the generated sitemap filenames * Add `filenameBase` to `@astro/sitemap` changeset * Add more detail based on review feedback
Changes
This adds a configuration option for the
@astrojs/sitemapintegration for setting the base filename for the generated sitemap XML files.Impact on existing users
The new configuration setting is defaulted to a value that matches current behavior so that existing users won't be impacted.
Use case
Scenario: Astro is chosen for adding informational content pages for an existing product website at a set of top-level content categories, e.g.,
Docs,Blog, andChangelog. The content verticals need to be hosted on the root domain at/docs,/blog, and/changelog, respectively.E.g., the Docs URL will be
https://example.com/docs.Problem: Currently, the generated sitemap files want to live at
https://example.com/sitemap-index.xmlandhttps://example.com/sitemap-{n}.xml, which will potentially conflict with an existingsitemap.xmlfor the root domain.Solution: Add a config setting to change the generated filename so that the files can be integrated into a pre-existing
sitemap-index.xmlvia other external tooling.Testing
A test was added to the relevant test file. The change was also tested in a live Astro app using a local build of the integration package.
Docs
Documentation for the setting could / should be added to the related guide. Initial suggested changes PR has been opened here: withastro/docs#11614.
/cc @withastro/maintainers-docs for feedback!