Skip to content

feat(sitemap): add namespaces configuration option#14285

Merged
florian-lefebvre merged 10 commits intowithastro:mainfrom
jdcolombo:feat/sitemap-namespaces-config
Sep 17, 2025
Merged

feat(sitemap): add namespaces configuration option#14285
florian-lefebvre merged 10 commits intowithastro:mainfrom
jdcolombo:feat/sitemap-namespaces-config

Conversation

@jdcolombo
Copy link
Copy Markdown
Contributor

Add support for customizing XML namespaces in generated sitemaps through a new namespaces configuration option. This allows users to exclude unused namespaces like xmlns:news for cleaner sitemap files.

  • Add namespaces option to SitemapOptions type
  • Update schema validation for namespaces configuration
  • Implement namespace filtering in writeSitemap function
  • Add comprehensive tests for namespace configuration
  • Maintain backward compatibility with all namespaces enabled by default

Changes

  • Introduces a new namespaces option in the sitemap integration config.
  • Users can now selectively enable/disable XML namespaces (news, xhtml, image, video) in generated sitemaps.
  • Schema validation updated to support the new option.
  • The sitemap XML output now reflects the selected namespaces.
  • Adds tests to verify correct namespace inclusion/exclusion.
  • Default behavior remains unchanged (all namespaces included).

Testing

  • Added unit and integration tests for all namespace configuration scenarios.
  • Verified that disabling specific namespaces removes them from the output XML.
  • Ensured backward compatibility by testing default config.

Docs

  • This change adds a new config option for users. Documentation should be updated to describe the namespaces option and provide usage examples.
  • /cc @withastro/maintainers-docs for feedback!

Add support for customizing XML namespaces in generated sitemaps through a new namespaces configuration option. This allows users to exclude unused namespaces like xmlns:news for cleaner sitemap files.

- Add namespaces option to SitemapOptions type
- Update schema validation for namespaces configuration
- Implement namespace filtering in writeSitemap function
- Add comprehensive tests for namespace configuration
- Maintain backward compatibility with all namespaces enabled by default
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Aug 29, 2025

🦋 Changeset detected

Latest commit: 7e2882c

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Aug 29, 2025
@ascorbic
Copy link
Copy Markdown
Contributor

Thanks! This will need a changeset (minor), which details of what has changed. Treat this as the first version of the docs changes. This will need a docs PR too, because the options are documented in the main docs site.

Copy link
Copy Markdown
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a cool new feature, @jdcolombo ! Just a temporary block on this to let everyone know I'm here, and I'm reviewing the changeset and docs! 🙌

Copy link
Copy Markdown
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think people are really going to be excited about removing XML bloat, @jdcolombo -- thank you for this feature!

Left some suggestions in the changeset for your consideration. You are the subject matter expert, and can feel free to adjust my proposed wording if I haven't got something exactly write. But you can use the style/format below as an idea of what we would typically include here. See what you think!

@sarah11918 sarah11918 dismissed their stale review September 4, 2025 15:42

Docs is in here now!

jdcolombo and others added 4 commits September 5, 2025 08:59
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
@ematipico ematipico added this to the v5.14.0 milestone Sep 5, 2025
Copy link
Copy Markdown
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for docs! 🎉

@florian-lefebvre florian-lefebvre merged commit bedc31b into withastro:main Sep 17, 2025
18 of 19 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants