Skip to content

fix(ui): build sitemap.xml from the pages the prerender renders - #10379

Merged
JSONbored merged 1 commit into
mainfrom
fix/ui-sitemap-from-rendered-pages
Dec 2, 2026
Merged

JSONbored merged 1 commit into
mainfrom
fix/ui-sitemap-from-rendered-pages

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

public/sitemap.xml was hand-kept and listed 34 pages. Most docs pages, the fairness report and the install pages were reachable only by following links.

  • src/lib/sitemap.ts builds the sitemap from rendered pages. canonicalUrlOf takes the URL each page names in <link rel="canonical">, falling back to its own loopover.ai URL. sitemapXml writes each URL once, sorted, so a rebuild of the same site produces identical bytes, with XML escaping. Both refuse a URL on another host.
  • scripts/prerender-static.ts adds every rendered page's canonical URL to a set during its crawl and writes dist/client/sitemap.xml. The prerender fails if a page names a canonical URL on another host or if the sitemap is not written. It no longer reads the hand-kept file as a seed; the route files, the docs directory and the OpenAPI spec already seed every page.
  • public/sitemap.xml is deleted, so the list cannot drift from what is served.
  • Pages that defer to another canonical URL appear once, under that URL. For example, every /api/<operation> page names /api as canonical, so the sitemap lists /api rather than each operation page.
  • ui-deploy.yml's build-output step prints the sitemap's URL count.

Validation

  • src/lib/sitemap.test.ts covers both canonical attribute orders, the fallback, foreign-host refusal, de-duplication and sorting, the exact XML shape, and escaping.
  • The module also loads and runs under the prerender's own runtime (node --experimental-strip-types), with the same outputs and errors.
  • Prettier 3.9.6 passes on the changed files. This PR's Deploy UI run builds and prerenders the full site, writing the new sitemap.

public/sitemap.xml was kept by hand and listed 34 of the site's pages; the rest (most docs pages, the fairness
report, the install pages) were reachable only by links. The prerender now writes sitemap.xml from its own
crawl: every rendered page's canonical URL, deduplicated and sorted, so the sitemap lists exactly what the
site serves. A page naming a canonical URL on another host fails the prerender.
@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Bundle Report

Changes will decrease total bundle size by 2.3kB (-0.06%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
loopover-ui 3.77MB -2.3kB (-0.06%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: loopover-ui

Assets Changed:

Asset Name Size Change Total Size Change (%)
sitemap.xml (Deleted) -2.3kB 0 bytes -100.0% 🗑️

@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.09%. Comparing base (48a4a7b) to head (20d1f11).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10379   +/-   ##
=======================================
  Coverage   92.09%   92.09%           
=======================================
  Files         913      913           
  Lines      111637   111637           
  Branches    27310    27310           
=======================================
  Hits       102810   102810           
  Misses       7527     7527           
  Partials     1300     1300           
Flag Coverage Δ
backend 95.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@JSONbored
JSONbored merged commit 791a9ac into main Dec 2, 2026
10 checks passed
@JSONbored
JSONbored deleted the fix/ui-sitemap-from-rendered-pages branch December 2, 2026 09:28
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