Repository navigation
fix(build): advertise the web feeds on static pages built with --feed - #676
Merged
Merged
Conversation
`cook build web --feed` writes atom.xml and rss.xml at the output root, but the `<link rel="alternate">` tags added in 353941f sat inside `{% if !static_mode %}`, so static pages never pointed feed readers at them. FeatureFlags gains `feeds`: always on for `cook server`, and on for a static build only when it writes the feeds. base.html tests that flag instead of static_mode; hrefs use the page's prefix, so they resolve from any depth (./atom.xml, ../atom.xml, ../../atom.xml) or from --base-url. Closes cooklang#595 Co-Authored-By: Claude Opus 5.5 <[email protected]>
LeMyst
marked this pull request as ready for review
October 10, 2026 21:10
This was referenced Oct 10, 2026
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.
Closes #595
Problem
cook build web --feedwritesatom.xmlandrss.xmlat the output root, but the<link rel="alternate">autodiscovery tags added in 353941f (#521) sit inside{% if !static_mode %}intemplates/base.html. Static sites never point feed readers at their feeds, so a reader given the site's address finds nothing. As @drawmeanelephant found in the issue,cook serverwas already fine.Fix
FeatureFlagsgainsfeeds. It defaults totrue, sincecook serveralways serves the feeds (recipes-only guests included, because/atom.xmland/rss.xmlare on their allowlist).cook build websets it to whether this build writes the feeds (--feed), and passes it throughrender_index/render_directory/render_recipeinstead ofFeatureFlags::default().base.htmltestsfeatures.feedsinstead of!static_mode. The hrefs keep using{{ prefix }}, so they resolve from every page depth (./atom.xml,../atom.xml,../../atom.xml) and from--base-urlwhen it is set.--feed, static pages still carry no feed links, so they never point at files that don't exist.There is no
feed.json: the issue suggested JSON Feed too, but only Atom and RSS exist, so only those are advertised.Tests
tests/build.rs:build_writes_feeds_when_feed_setnow checks that the index, a directory page, a recipe page and a menu page link both feeds with the right relative prefix.build_omits_feeds_when_feed_not_setchecks that pages carry norel="alternate".tests/server_feed_test.rs::pages_advertise_the_feedsstill passes, so the server side is unchanged.cargo fmt,cargo clippy --all-targets(no warnings) andcargo testall pass.🤖 Generated with Claude Code