Repository navigation
fix(build): leave the output dir out of the listing pages - #634
Merged
Merged
Conversation
`cook build web` copies each recipe's source into `_site/recipe/`, so on the next build with `_site` inside the recipe folder, the index and directory pages listed `_site` as a folder (linking to a directory page that is never written). The build already pruned the output dir from its own recipe tree since f6703df (cooklang#344), but the listing pages rebuild a tree from disk in `build_recipes_template`, which did not. `RecipesBuildInput` now takes the dir to exclude and prunes it with the same helper, and today's menu skips menus copied into it. Closes cooklang#632 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #632
Problem
cook build webcopies each recipe's.cooksource next to its page (_site/recipe/*.cook). When_sitesits inside the recipe folder (the default), the next build finds recipes under it and the index lists_siteas a folder. The link is dead too, since nodirectory/_site.htmlis written.cook build(f6703df, #344) already prunes the output dir from the tree it walks (prune_output_subtree), but the index and directory pages go throughbuild_recipes_template, which builds its own tree from disk and never pruned it.Fix
RecipesBuildInputgets anexclude: Option<&Utf8Path>field. The static renderer passes the output dir; the server passesNone.web::builders::prune_subtree, used by bothrun_weband the listing builder.find_todays_menuskips menus under the excluded dir, so a dated menu copied into_site/menu/can't become "today's menu" on the next build.Tests
tests/build.rs::build_twice_does_not_list_output_dir: builds twice intorecipes/_site, then checks that neitherindex.htmlnor anydirectory/*.htmlmentions_site. It fails without the renderer change.web::menus::tests::find_todays_menu_skips_excluded_dir.cargo fmt,cargo clippy --all-targetsandcargo testall pass. I also reproduced the issue's layout by hand (cook build web --base-url /recipes/, run several times):_siteno longer shows up.🤖 Generated with Claude Code