Repository navigation
feat(feed): site-wide recent-comments feed in Atom and JSON Feed - #239
Merged
Merged
Conversation
…ing comment anchor
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.
Why
Blogs often show a "latest comments" list in a sidebar or footer. Garrul only had per-post feeds, so an operator could not get the newest comments across the site.
This adds
GET /feed(Atom) andGET /feed?format=json(JSON Feed 1.1), optionally narrowed to one site with?site=<origin>. Static sites fetch it at build time and render the list as HTML, so it costs zero Worker requests per pageview. There is deliberately no live widget: a mount on every page would add a Worker request per view./feedsits outside the/api/*Origin gate, so build steps with noOriginheader can fetch it. JSON also sendsaccess-control-allow-origin: *.sitemust equal anALLOWED_ORIGINSentry in browser-serialized form, else400 invalid site.formatandsiteare normalized before the cache key, so junk query strings cannot mint cache entries.posts.urlin the Worker, because imported rows can hold non-canonical spellings. The per-site query keeps a unary+c.status, pinned by anEXPLAIN QUERY PLANtest./feed/:sluglinked to post URLs outsideALLOWED_ORIGINSand built dead anchors like#section&garrul-comment-<id>. Both routes now share one link helper.docs/embedding.md, and fail-soft build-time recipes for Astro, Hugo (≥ 0.141) and Jekyll.No env vars, no migration, no new endpoint under
/api/v1.Linked issue
none
Checks
npm run lintnpm run typechecknpm testREADME.md,CLAUDE.md,docs/) if conventions or public behavior changed