feat(server): tag pages, so a recipe can belong to several collections
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- html, rust
- Ambito
- build-system, full-stack
Direzione di ricerca
Start with src/build/index.rs::collect to see how the existing tree walk gathers recipe.tags() and URL stems, then factor that walk into src/web/builders.rs. Read recipes_handler in src/server/ui.rs for the route pattern, and render_directory in src/build/mod.rs plus src/build/renderer.rs for static output; the card markup to extract lives in templates/recipes.html, with strings in locales/*/. Done when /tags and /tag/{tag} list and link tags case-insensitively, cook build web emits tags.html and tag/<tag>.html, and collector, isolated-server, build and Playwright tests cover the listed cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Folders give each recipe exactly one place. A recipe like "red sauce pasta" belongs in lunch, dinner, pasta and easy meals all at once, and moving or copying the file is not an answer. This came up on Discord: someone wanted "collections" in cook server that can reference the same recipe file more than once.
Tags already cover the writing side. tags: [dinner, pasta] (or tags: dinner, pasta) in the frontmatter is parsed, and the server shows tags on the recipe cards (templates/recipes.html) and on the recipe page (templates/recipe.html). They are plain text, though, and no page lists "every recipe tagged dinner".
Proposal: tag pages
- Writing stays the same. Frontmatter
tags, on.cookand.menufiles. /tag/dinnershows every recipe and menu taggeddinner, from every folder, in one flat grid with the same cards as the home page. Each card shows its folder (Pasta/), so two recipes with the same name can be told apart. Sorted by name./tagslists every tag with its count (dinner · 14). The home page and the small-screen menu link to it.- Tags become links. On the recipe page,
#dinnerlinks to/tag/dinner. The tags on listing cards stay plain text for now, because each card is already a single<a>and a link cannot sit inside another link. - Matching ignores case and surrounding spaces:
Dinneranddinnerare the same tag, shown with the spelling seen first. There is no hierarchy, someal/dinneris just a name. - Static sites:
cook build webalso renderstags.htmlandtag/<name>.html.
Not in a first version, but possible follow-ups: combining tags (?tag=dinner&tag=easy), filter chips on folder pages, and cook search --tag.
Implementation sketch
- Collect: walk
cooklang_find::build_tree(base_path)once, assrc/build/index.rs::collectalready does (recipe.tags(), URL stem fromfile_name()). Factor that walk into a shared helper insrc/web/builders.rsthat both the new builders and the static search index use. - Templates: move the card markup out of
templates/recipes.htmlinto an include, so the tag page renders the same cards. Addtags.htmlandtag.htmlwith structs insrc/web/templates.rs, reusingRecipeItemwith an addedfolder: Option<String>. - Routes:
GET /tagsandGET /tag/{*tag}insrc/server/ui.rs, following therecipes_handlerpattern. Both are read-only GETs, soauth::middleware::required_capabilityneeds no change and thereaderrole can see them. - Static build:
render_tags/render_taginsrc/build/renderer.rs, called fromsrc/build/mod.rsnext torender_directory. File names are percent-encoded for tags containing spaces or/. Add the pages tositemap.rs. - i18n: a few new strings in all
locales/*/. - API:
/api/recipesalready returns normalisedtags, so API clients can filter today. No new endpoint is needed. - Tests: unit tests for the collector (case folding, menus, the same tag in two folders, untagged recipes); a
cook serverintegration test throughcommon::with_isolated_config; a Playwright test going from a recipe's tag to the tag page;cook build weboutput.
- Lingua principale
- Rust
- Stelle
- 1.4k
- Fork
- 120
- Merge medio
- 1g 22h
- PR unite (30g)
- 128
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cooklang/cookcli
-
Editor save status and save errors are in English whatever the site's languageForse già presa @LeMyst l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Shopping list counts a recipe twice when three or more menus reference each other in a ringForse già presa @LeMyst l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
wontfix
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
cooklang/cookcli#784 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
cooklang/cookcli#763 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
area: pantry feature request needs discussion
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cooklang/cookcli
Issue simili
-
priority middle
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
KATO-Hiro/AtCoderClans#12940 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
hurttlocker/o8#5112 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno