Skip to content

Test sitemap stays in sync with prerendered pages - #274

Draft
manav4u wants to merge 1 commit into
mainfrom
test/sitemap-sync
Draft

manav4u wants to merge 1 commit into
mainfrom
test/sitemap-sync

Conversation

@manav4u

@manav4u manav4u commented Nov 4, 2026

Copy link
Copy Markdown
Owner

What

Adds tests/sitemap.test.ts: four tests that derive the expected sitemap URL set from the same sources scripts/prerender.mjs renders (subject configs in scripts/pages/, info pages, SE/TE branches and their seData course lists, using the same slugify rule as coursePath) and compare it against public/sitemap.xml.

Why

The two failures that hurt crawling are a prerendered page that never gets listed (invisible to Google) and a stale entry pointing crawlers at a removed page. Until now nothing caught either; this fails the test suite in both cases. It also pins the canonical origin and trailing-slash form, changefreq/lastmod validity, homepage priority 1.0, and the robots.txt sitemap reference.

Notes

  • Current state verified clean while writing this: all 170 sitemap URLs map 1:1 to rendered pages, no duplicates, no stale entries. /privacy/ is prerendered but intentionally unlisted, which the test encodes.
  • Observation only, not changed here: the three TE branch sections (51 entries) carry no lastmod. That's valid per the sitemap protocol, so the test requires any present lastmod to be a real, non-future date rather than requiring one everywhere.

Checks

  • New tests 4/4 pass; full suite 108/108 (npm test).
  • No production or build output change; test file only.

Co-authored-by: MaxwithU19 156198184+MaxwithU19@users.noreply.github.com

Derives the expected URL set from the same sources scripts/prerender.mjs
renders (subject configs, info pages, SE/TE branches and their course
data) and fails if a rendered page is missing from public/sitemap.xml or
an entry points at a page that no longer exists. Also pins the canonical
origin and trailing-slash form, changefreq/lastmod validity, homepage
priority and the robots.txt sitemap reference.

Co-authored-by: MaxwithU19 <156198184+MaxwithU19@users.noreply.github.com>

This branch has not been deployed

No deployments
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