Depends on
#91 — blog section with per-post exported metadata.
Problem
Search engines benefit from an accurate sitemap.xml with <lastmod> per URL. The official @astrojs/sitemap integration auto-discovers pages but doesn't know about custom per-post updatedDate metadata, so <lastmod> entries for blog posts would be inaccurate (or missing) without custom handling.
Proposed change
Once #91 lands, every blog post already exports pubDate and updatedDate as part of its metadata contract. That makes tuning the sitemap essentially free: reuse the same import.meta.glob pattern used by /rss.xml, and emit <loc> + <lastmod> per post.
Scope
- Custom sitemap endpoint at
/sitemap.xml (or /blog-sitemap.xml alongside the default) that:
- Globs blog post files
- Emits
<loc> from the post URL and <lastmod> from updatedDate (falling back to pubDate)
- Skips drafts
- Decide between: (a) fully custom sitemap covering all pages, or (b) keep
@astrojs/sitemap for static pages and add a separate blog sitemap plus a sitemap index. Option (a) is simpler if page count stays small.
- Verify output against Google Search Console's sitemap validator.
Why this is easy after #91
The blog system introduced in #91 defines a metadata contract (title, pubDate, updatedDate, draft, …) and a glob-based discovery pattern. The sitemap is just a second consumer of that same contract — the data model is already there, we only add another endpoint that projects it into a different XML shape.
Files
frontend/src/pages/sitemap.xml.ts (or blog-sitemap.xml.ts) — new
frontend/astro.config.mjs — adjust @astrojs/sitemap config depending on chosen approach
Depends on
#91 — blog section with per-post exported metadata.
Problem
Search engines benefit from an accurate
sitemap.xmlwith<lastmod>per URL. The official@astrojs/sitemapintegration auto-discovers pages but doesn't know about custom per-postupdatedDatemetadata, so<lastmod>entries for blog posts would be inaccurate (or missing) without custom handling.Proposed change
Once #91 lands, every blog post already exports
pubDateandupdatedDateas part of its metadata contract. That makes tuning the sitemap essentially free: reuse the sameimport.meta.globpattern used by/rss.xml, and emit<loc>+<lastmod>per post.Scope
/sitemap.xml(or/blog-sitemap.xmlalongside the default) that:<loc>from the post URL and<lastmod>fromupdatedDate(falling back topubDate)@astrojs/sitemapfor static pages and add a separate blog sitemap plus a sitemap index. Option (a) is simpler if page count stays small.Why this is easy after #91
The blog system introduced in #91 defines a metadata contract (title,
pubDate,updatedDate, draft, …) and a glob-based discovery pattern. The sitemap is just a second consumer of that same contract — the data model is already there, we only add another endpoint that projects it into a different XML shape.Files
frontend/src/pages/sitemap.xml.ts(orblog-sitemap.xml.ts) — newfrontend/astro.config.mjs— adjust@astrojs/sitemapconfig depending on chosen approach