Add blog RSS feed and robots.txt - #153
Merged
Merged
Conversation
The live site 404s on /rss.xml, /feed.xml, and /robots.txt. Add a
prerendered RSS 2.0 feed (with content:encoded and atom:link self)
for the blog, a robots.txt that disallows /api/ and the owner-only
/owner page while pointing at the sitemap, and an RSS autodiscovery
link in the document head.
The feed serializer lives in a pure src/lib/server/rss.ts module
(mirroring the sitemap.ts pattern) with a vitest suite covering XML
escaping, RFC-822 date formatting, CDATA safety for embedded ]]>,
absolutizing root-relative src/href attributes, and replacing the
site's {super:x}/{sub:x} markers with real <sup>/<sub> tags so feed
readers don't see raw markers.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3mdistal
marked this pull request as ready for review
September 25, 2026 13:23
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The live site 404s on
/rss.xml,/feed.xml, and/robots.txt. There's no way for feed readers to subscribe to the blog, and norobots.txtto guide crawlers to the sitemap or away from/api/and the owner-only/ownerediting page.Changes
src/lib/server/rss.ts(new): a pure, testable RSS 2.0 serializer, mirroring the existingsrc/lib/server/sitemap.tspattern. Exports small focused helpers (escapeXml,toRfc822,wrapCdata/makeCdataSafe,applySubAndSuperMarkers,absolutizeHtmlUrls) plusserializeRssFeed, which assembles the<rss>document with thecontentandatomnamespaces.applySubAndSuperMarkersis the feed-safe (pure string) equivalent of the browser-onlysubAndSuperinsrc/lib/notion/utils/blog-helpers.ts— it turns{super:x}/{sub:x}markers into real<sup>/<sub>tags so feed readers (which never run the site's client JS) don't see raw markers. On-site rendering is unchanged.absolutizeHtmlUrlsrewrites root-relativesrc="/..."/href="/..."attributes to absolute URLs; already-absolute and protocol-relative URLs are left alone.]]>so it can't terminate the section early.src/routes/rss.xml/+server.ts(new): a prerendered endpoint (export const prerender = true) that loads all blog posts (loadPostsMeta/loadPostBySlug), renders each with the existingrenderBlogMarkdown, and serializes the feed. Channel title is "Alice Alexandra Moore", link is/blog, description reuses the blog index's meta description, and each item includes title, link/guid,pubDate,category, a description (summary, falling back toogDescriptionthensubtitle), andcontent:encodedwith the full rendered HTML.static/robots.txt(new): allows everything except/api/and/owner, and points athttps://www.alicealexandra.com/sitemap.xml.src/app.html: adds<link rel="alternate" type="application/rss+xml" title="Alice Alexandra Moore" href="/rss.xml" />to<head>for feed-reader autodiscovery.src/lib/server/rss.test.ts(new): vitest coverage for XML escaping, RFC-822 date formatting, CDATA safety with embedded]]>(including a real round-trip throughfast-xml-parser), absolutizing URLs, sub/super marker replacement, and a full-feed structural test.Out of scope (per the task): no other SEO/metadata changes, no content-repo changes, no changes to how posts render on-site. Another parallel change was touching
src/routes/+layout.svelteand blog route files, so those were intentionally left untouched.Testing
pnpm lint— passes (Prettier + ESLint clean).pnpm check— passes (svelte-check: 0 errors, 0 warnings across 550 files).pnpm exec vitest --run— 54/54 tests pass across 9 files, including the 18 newrss.test.tscases.svelte-kit sync && vite build, then restoredcontent/career/builder.json(the build rewrites it)..svelte-kit/output/prerendered/pages/rss.xmlexists, parses as well-formed XML (python3 -m xml.dom.minidom), and contains exactly 13<item>entries — one percontent/blog/posts.jsonentry, newest first.{super:/{sub:markers anywhere in the output; spot-checkedfull-speed-to-dopamine's item and confirmed{super:TM}became<sup>TM</sup>incontent:encoded.content:encoded(already absolute in source content) and confirmed a root-relative link (/about#connect, present in two posts) was rewritten tohttps://www.alicealexandra.com/about#connect..svelte-kit/output/prerendered/pages/blog.html(and other pages, since the link lives inapp.html) contains the new<link rel="alternate" ...>tag..svelte-kit/output/client/robots.txtmatches the intended rules and includes theSitemap:line.vite preview --port 4392and curled:GET /robots.txt→ 200, body matches expected rules and Sitemap line.GET /rss.xml→ 200, butvite preview's static file server reportscontent-type: text/xml, notapplication/rss+xml. I confirmed this is a pre-existingvite previewquirk, not something new:GET /sitemap.xmlshows the exact sametext/xmllocally despite its+server.tsalso declaringapplication/xml. In production, Vercel serves prerendered.xmlfiles by extension: the live/sitemap.xml(same pattern) comes back asapplication/xml, so expect/rss.xmlto beapplication/xmltoo. Feed readers accept that, so no workaround is needed.Unverified
/rss.xmland/robots.txtcouldn't be fetched there. Both will be confirmed on production after merge.fast-xml-parser/xml.dom.minidomwell-formedness checks and manual review of required RSS 2.0 elements instead.🤖 Generated with Claude Code