Skip to content

Add rendering metadata and sitemap route controls - #9

Merged
magiccodingman merged 14 commits into
mainfrom
agent/rendering-metadata-sitemap-control
Jul 27, 2026
Merged

Add rendering metadata and sitemap route controls#9
magiccodingman merged 14 commits into
mainfrom
agent/rendering-metadata-sitemap-control

Conversation

@magiccodingman

Copy link
Copy Markdown
Owner

What changed

  • safely add these declarations to the output copy of the root loader and every canonical snapshot HTML document:
<meta name="rendering-mode" content="static-prerendered">
<meta name="snapshot-protocol" content="1">
  • use AngleSharp DOM parsing, duplicate/conflict checks, semantic fingerprint verification, and a safe preserve-with-warning fallback rather than regex insertion
  • leave source files untouched and do not annotate case redirects or prefix gateways
  • introduce sitemap representation metadata under urn:snapshot-protocol:rendering:1
  • keep ordinary sitemap URLs prerenderable by default
  • treat <render:representation>client-rendered</render:representation> as a route-level instruction to leave that URL to the SPA
  • accept existing static-prerendered and legacy prerendered declarations without duplication
  • fail discovery before browser startup when an explicit --route contradicts a sitemap client-rendered declaration
  • annotate successfully planned canonical URLs in the ZIP's sitemap copies as static-prerendered
  • annotate local sitemap-index child entries only when every URL in that child sitemap is represented by the completed snapshot plan
  • preserve gzip sitemap format when annotating .xml.gz

Behavior

Default sitemap URL

<url>
  <loc>https://example.test/docs</loc>
</url>

The route is prerendered as before. The output sitemap copy receives:

<render:representation>static-prerendered</render:representation>

Client-rendered route

<url>
  <loc>https://example.test/account/live</loc>
  <render:representation>client-rendered</render:representation>
</url>

Snapshot skips the route. An explicit override for the same route is an early configuration error rather than silently choosing one instruction.

Safety

  • all HTML mutation uses a DOM parser
  • existing conflicting or duplicate metadata causes the original output HTML to be preserved with PROCESS103
  • serialized HTML is reparsed and compared using a semantic fingerprint that excludes only the two managed metadata elements
  • sitemap elements are matched by expanded XML namespace name, not by a hardcoded prefix
  • existing recognized sitemap declarations are preserved and never duplicated
  • source HTML and sitemap files are never modified

Validation

Added coverage for:

  • HTML metadata insertion, idempotence, conflicts, script/text preservation, and validation-only processing
  • default, legacy prerendered, static-prerendered, and client-rendered sitemap discovery
  • explicit-route conflicts before renderer invocation
  • output loader, generated snapshot, and developer-provided canonical HTML annotation
  • absence of metadata on redirects
  • mixed sitemap indexes and fully-prerendered child summaries
  • gzip sitemap round trips
  • end-to-end Blazor output metadata

The XML and HTML conventions are documented in docs/rendering-metadata.md.

@magiccodingman
magiccodingman marked this pull request as ready for review July 27, 2026 17:00
@magiccodingman
magiccodingman merged commit e7c1e28 into main Jul 27, 2026
4 checks passed
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