Skip to content

feat(sitemap): enhance customPages support in SitemapOptions #14044

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adesege
Copy link

@adesege adesege commented Jul 4, 2025

Changes

  • Add support for async customPages function in sitemap integration
  • customPages option now accepts either an array of URLs or an async function that returns URLs
  • Updated schema validation to support both array and function types
  • Function receives the site URL as parameter for dynamic URL generation

Testing

  • Added test case to verify async customPages function works in SSR mode
  • Created new test fixture page /solutions/[...solution].astro for catch-all route
  • Updated SSR test config to use async function that generates solution URLs
  • Verified generated sitemap includes custom pages from async function

Docs

/cc @withastro/maintainers-docs for feedback!

- Updated SitemapOptions to allow customPages to be a function returning either an array of strings or a promise resolving to an array of strings.
- Modified createPlugin to handle the new customPages type.
- Added tests to verify correct URL generation with custom pages in SSR.
- Included a new fixture for testing custom pages in the sitemap integration.
Copy link

changeset-bot bot commented Jul 4, 2025

⚠️ No Changeset found

Latest commit: f803c42

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Jul 4, 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.

1 participant