feat(news): categories field on news items + category filter on news-list #134
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle!134
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/130"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #130
Final slice of the News v2 categories stack (#77 → #128 → #129 → this): categories become editor-visible on news items and filterable on the news-list element.
What changed
Sidecars (the curation model from #77: vocabulary curated in sidecar options)
news-itempage type: newcategoriesfield,type: multiselect, starter vocabulary[announcements, company, events, product]. The field key is exactly the taxonomy key, so the front-matter list the editor writes feeds the Hugo taxonomy directly.news-listelement: new optionalcategoryparam,type: select, same vocabulary. Single-valued by design (element params are shortcode scalars). Optional + defaultless, so the editor renders a leading empty option and omits the attribute entirely when unset.TestNewsBundleSidecarsLoadnow asserts the two options lists are identical — the lockstep is mechanically enforced, not just promised.Templates
where … "Params.categories" "intersect"→ date desc →first limit, so the limit caps the filtered count. Unset category takes the exact pre-existing path (whitespace-identical output)./categories/<term>/. Uncategorized items render no list at all.Docs:
harness add newsnext-steps text no longer claims the editor field "ships separately"; the AGENTS.md feature-bundle paragraph describes the field, the filter param, and the by-hand lockstep.Tests
TestNewsBundleSidecarsLoad.category="company" limit=2proves limit-after-filter (3 company items, oldest cut) and non-matching-but-newer exclusion;category="product" limit=20proves exactly the 11 carriers render, excluding the draft and the uncategorized future item. Draft exclusion re-checked under--buildDrafts.Full
go test ./...and the 973-test web suite are green.Verified end-to-end
Beyond tests: scaffolded a fresh site, ran the real
harness add news, drove the editor in Chromium (Playwright) — toggled the Categories chips on an item and saved (categories = ["company", "product"]landed as a native TOML list), set Category on a news-list element (category="company"landed in the shortcode) — and observed the live Hugo preview: filtered listing, term links on detail/list/term pages, empty-but-valid output for vocabulary-without-items and hand-typed bogus categories, section RSS unchanged, no term feeds.While verifying I hit a pre-existing Page Settings datetime validation bug (unrelated to this change) — filed as #133.
🤖 Generated with Claude Code
Landing audit — PASS
Verification signal relied on: Forgejo Actions
ci / build-and-test— success (6m23s). The workflow is unconditional onpull_requestand runs the frontend build +npm test, thengo vet ./...,go test ./...,go buildwith the pinned Hugo extended v0.163.3. The theme-build fixtures that carry this PR's new assertions run inside thatgo test, so the green light genuinely exercised the changed path. Not re-run locally.Checks performed
main(no conflicts).feat(news): …is Conventional Commits; body carries a workingCloses #130.scaffold/site/AGENTS.mdhad to move; it does, describing thecategoriesmultiselect field, thecategoryfilter param, and the hand-maintained lockstep.Notes from the diff read (non-blocking)
categorypath is whitespace-identical to the previous single-line pipeline — every new action opens with{{-, so the emitted text is unchanged, and the untouched home/updates fixtures pin that.$items = …(assignment, not:=) inside thewith $categoryblock correctly mutates the outer variable rather than shadowing it.first $limit, so the limit caps the filtered count; thecompany-newsfixture (3 matches,limit=2) is a real proof of that ordering, not a tautology.TestNewsBundleSidecarsLoadnow asserts the two options lists are equal — the promise is mechanically enforced.Verdict: PASS. No blockers, no concerns. Awaiting the human's merge confirmation.