[template] sitemap: paged shards matching Hydrogen's model#311
Merged
Conversation
Replaces the single eagerly-loaded sitemap (every product handle in one
XML, plus the first 250 collections only) with a sitemap index + paged
child sitemaps backed by Shopify's Storefront `sitemap(type:)` query.
- /sitemap.xml — index listing every shard
- /sitemap/static.xml — home
- /sitemap/products-{n}.xml — up to 250 products per shard
- /sitemap/collections-{n}.xml — same for collections
`getAllProductHandles` is gone; new ops are `getShopifySitemapPagesCount`
and `getShopifySitemapPage`. Implemented as plain route handlers because
Next.js 16 reserves /sitemap.xml for app/sitemap.ts even when
generateSitemaps doesn't auto-emit a sitemap index there.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Adds anatomy/sitemap.mdx documenting the index + paged-shard URLs, cache behavior, and how to extend to more SitemapType resources. Updates anatomy/aeo-geo.mdx to point at the new route handler paths instead of the deleted app/sitemap.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three skills walked through editing app/sitemap.ts directly. After the
refactor that file no longer exists; updates point at the new route
handlers and gesture at how to extend them:
- enable-i18n: Step 8 per-locale sitemap now describes editing
app/sitemap/[shard]/route.ts to emit xhtml:link alternates per <url>.
Verifying step curls a child shard, not just the index.
- enable-shopify-markets: same Step 12 update; also fixes the
middleware matcher to exclude /sitemap/ children, not just
/sitemap.xml (otherwise the locale rewrite would catch child shards).
- enable-shopify-cms: one-line path fix; gestures at adding a
cms-pages-{n} shard for indexing CMS pages.
apps/docs/content/docs/skills/*.mdx synced via sync-skills.ts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts: # apps/docs/content/docs/anatomy/aeo-geo.mdx
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Key files section listed `/sitemap.xml` (a URL) which the path linter resolved as a file. Reworded to drop the path-like token. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The index route hardcodes product and collection shards; it does not discover new SitemapTypes automatically. Document the count-fetch + child-id edit in sitemap.xml/route.ts as a required third step. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sitemap(type:)query — same model Hydrogen uses/sitemap.xml(index) +/sitemap/{static,products-{n},collections-{n}}.xml(children, ≤250 entries each)app/sitemap.ts+generateSitemaps: Next.js 16 reserves/sitemap.xmlfor the metadata file even thoughgenerateSitemapsdoesn't actually emit a sitemap index there, so the two collide. Owning both routes manually sidesteps thatWhy
sitemapquery is purpose-built for this — Shopify computes the pagination, ≤250 items per pageDeliberately not in scope
Sitemap.image.filepathis a path fragment, but<image:loc>requires an absolute URL. Resolving the CDN base is left as future work — noted in the rollout entryTest plan
pnpm --filter template build— clean;/sitemap.xmlprerenders,/sitemap/[shard]is dynamic + cache-taggedcurl /sitemap.xml→<sitemapindex>listing every shardcurl /sitemap/static.xml→<urlset>with the home URLcurl /sitemap/products-1.xml→<urlset>of products with<loc>+<lastmod>curl /sitemap/collections-1.xml→<urlset>of collections🤖 Generated with Claude Code