Skip to content

fix(seo): generate sitemap.xml from routes at build time with git-derived lastmod - #13

Merged
bvallier merged 2 commits into
masterfrom
claude/sales-frequency-strategy-tco8pw
Sep 1, 2026
Merged

bvallier merged 2 commits into
masterfrom
claude/sales-frequency-strategy-tco8pw

Conversation

@bvallier

@bvallier bvallier commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

The sitemap shipped to production (demo/public/sitemap.xml) listed only 9 URLs while router/routes.ts defined 16 public routes — the 7 newest marketing guides were live and prerendered but never submitted to search engines. A complete 16-URL sitemap existed at demo/sitemap.xml, but Vite's root is demo, so publicDir resolves to demo/public and that file never shipped; demo/robots.txt was a dead duplicate for the same reason.

Changes

  • scripts/prerender.mjs now generates dist-demo/sitemap.xml from the same route list that drives prerendering, so a newly added guide can never go unlisted again
  • <lastmod> is derived from the last git commit touching each route's content files (not the build date, which would bump all 16 dates on every deploy and erode crawler trust in the sitemap); the optional tag is omitted when git can't answer, e.g. on a shallow CI clone
  • Deleted the three stale/dead static files: demo/public/sitemap.xml, demo/sitemap.xml, demo/robots.txt

Verification

  • pnpm build:demo emits dist-demo/sitemap.xml with all 16 URLs
  • Per-route dates confirmed correct (e.g. /vs-ag-grid keeps its June commit date) and stable across rebuilds
  • pnpm lint clean; demo/public/robots.txt (the served copy) still points at /sitemap.xml

Generated by Claude Code

The sitemap shipped to production lived at demo/public/sitemap.xml and
listed only 9 URLs. router/routes.ts had grown to 16 public routes, so
the 7 most recently added marketing guides — react-pivot-table-no-watermark,
vue-pivot-table-free, react-datagrid-csv-export, vue-datagrid-filter-sort-search,
react-datagrid-calculated-fields, vue-datagrid-column-resize and
nextjs-datagrid-pivot-table — were prerendered and live but never submitted
to search engines.

A second, more complete sitemap existed at demo/sitemap.xml, but Vite's
root is `demo` and publicDir therefore resolves to demo/public, so that
file was never copied into the build output. demo/robots.txt was a dead
duplicate of demo/public/robots.txt for the same reason.

Generate the sitemap in scripts/prerender.mjs from the same ROUTES list
that drives prerendering, so a newly added guide is always listed, and
delete the three stale/dead static files.

Verified: build:demo emits dist-demo/sitemap.xml with all 16 URLs.
Stamping every URL with the build date meant all 16 <lastmod> values
bumped on every deploy, including pages unchanged for months — the kind
of always-wrong freshness signal that teaches crawlers to distrust the
sitemap's dates entirely.

Date each route from the last commit touching its content files (Home.vue
for /, VsAgGrid.vue for the comparison page, MarketingGuide.vue +
router/routes.ts for guide pages), and omit the optional <lastmod> tag
when git can't answer (no repo, or a shallow CI clone whose truncated
history contains no commit for those files).

Verified: build:demo now emits per-route dates (e.g. /vs-ag-grid at its
June commit date) that hold stable across rebuilds.
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tiny-pivot Ready Ready Preview Sep 1, 2026 11:17am UTC

Request Review

@bvallier
bvallier merged commit 9126916 into master Sep 1, 2026
2 checks passed

This branch was successfully deployed

1 active deployment
Preview — c5ee176b Deployed Sep 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant