fix(theme): list branch-bundle children in page-teasers, section lists and nav #143

Merged
dominik.polakovics merged 1 commit from lab/20261004-1056 into main 2026-10-05 15:56:42 +02:00

Closes #142

Problem

Every page the editor creates is a branch bundle (<slug>/_index.md), but the page-teasers shortcode, the _default/list.html section listing and the header dropdown collected children with .RegularPages, which excludes branch bundles. On an editor-built site all three were always empty. The demo site only had plain-file children, so the tests never caught it.

Changes

  • Templates read .Pages (a section's immediate children of either kind) instead of .RegularPages, matching what the news bundle's templates already do. Draft filtering is unchanged.
  • New hideChildren: true front-matter flag. Listing bundle children would unfold every news article under the News menu entry on every page. A section with this flag is a plain nav item. The news page type stamps it on new news sections via defaults; the news test fixture carries it too.
  • Fixtures: posts/third/_index.md (a bundle post) and posts/draft-bundle/_index.md (a draft bundle) join the demo site.
  • Tests: teasers, the section list and the nav dropdown must include the bundle post and exclude both drafts; the news section must render as a plain nav entry without a dropdown.
  • Docs: theme README (nav section, flag table, new .Pages rule) and the element/template comments.

Verification

go test ./internal/theme/ passes against the pinned Hugo 0.163.3; go test ./... passes apart from the two packages that need the frontend bundle built.

Existing sites need the three changed theme layouts copied in, and hideChildren: true added to any news section already created.

🤖 Generated with Claude Code

Closes #142 ## Problem Every page the editor creates is a branch bundle (`<slug>/_index.md`), but the `page-teasers` shortcode, the `_default/list.html` section listing and the header dropdown collected children with `.RegularPages`, which excludes branch bundles. On an editor-built site all three were always empty. The demo site only had plain-file children, so the tests never caught it. ## Changes - **Templates read `.Pages`** (a section's immediate children of either kind) instead of `.RegularPages`, matching what the news bundle's templates already do. Draft filtering is unchanged. - **New `hideChildren: true` front-matter flag.** Listing bundle children would unfold every news article under the News menu entry on every page. A section with this flag is a plain nav item. The news page type stamps it on new news sections via `defaults`; the news test fixture carries it too. - **Fixtures:** `posts/third/_index.md` (a bundle post) and `posts/draft-bundle/_index.md` (a draft bundle) join the demo site. - **Tests:** teasers, the section list and the nav dropdown must include the bundle post and exclude both drafts; the news section must render as a plain nav entry without a dropdown. - **Docs:** theme README (nav section, flag table, new `.Pages` rule) and the element/template comments. ## Verification `go test ./internal/theme/` passes against the pinned Hugo 0.163.3; `go test ./...` passes apart from the two packages that need the frontend bundle built. Existing sites need the three changed theme layouts copied in, and `hideChildren: true` added to any news section already created. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(theme): list branch-bundle children in page-teasers, section lists and nav
All checks were successful
ci / build-and-test (pull_request) Successful in 7m1s
87c7b6dd09
Every page the editor creates is a branch bundle (<slug>/_index.md), but
the page-teasers shortcode, the _default/list.html section listing and the
header dropdown collected children with .RegularPages, which excludes
branch bundles. On an editor-built site all three were therefore always
empty. Read the section's immediate children from .Pages instead, as the
news bundle's templates already do.

Listing bundle children would also unfold every news article under the
News menu entry, so sections gain a `hideChildren: true` front-matter flag
that suppresses their nav dropdown; the news page type stamps it on every
new news section via defaults.

Fixtures: posts/third/_index.md (a bundle post) and a draft bundle join the
demo site, and the tests pin that teasers, the section list and the nav
dropdown include the bundle and exclude both drafts, and that the news
section stays a plain nav item.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Author
Owner

[autoland] verdict: pass

This was generated by AI while landing a PR.

PASS. Signal relied on: Forgejo Actions ci / build-and-test green on head 87c7b6d (not re-run).

  • Title is Conventional Commits; body carries Closes #142.
  • The diff matches #142: page-teasers, _default/list.html and the header nav read .Pages instead of .RegularPages. The new hideChildren flag is stamped on news sections via the page type's defaults. Branch-bundle and draft-bundle fixtures are added, and tests pin the behaviour for teasers, the section list, the nav dropdown and the plain News nav entry.
  • scaffold/site/AGENTS.md doesn't need a change: hideChildren is a theme front-matter flag, not a sidecar schema change, and defaults was already documented. The theme README documents it.
  • Main has moved by #146 since CI ran. It doesn't touch the theme, the library-site fixtures or the news page type, and git merge-tree merges cleanly.
[autoland] verdict: pass > *This was generated by AI while landing a PR.* **PASS.** Signal relied on: Forgejo Actions `ci / build-and-test` green on head 87c7b6d (not re-run). - Title is Conventional Commits; body carries `Closes #142`. - The diff matches #142: `page-teasers`, `_default/list.html` and the header nav read `.Pages` instead of `.RegularPages`. The new `hideChildren` flag is stamped on news sections via the page type's `defaults`. Branch-bundle and draft-bundle fixtures are added, and tests pin the behaviour for teasers, the section list, the nav dropdown and the plain News nav entry. - `scaffold/site/AGENTS.md` doesn't need a change: `hideChildren` is a theme front-matter flag, not a sidecar schema change, and `defaults` was already documented. The theme README documents it. - Main has moved by #146 since CI ran. It doesn't touch the theme, the library-site fixtures or the news page type, and `git merge-tree` merges cleanly.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/deckle!143
No description provided.