Skip to content

fix(themes): resolve Kida 0.7.0 strict_undefined render errors#243

Merged
lbliii merged 2 commits intomainfrom
lbliii/fix-submenu-children
Apr 21, 2026
Merged

fix(themes): resolve Kida 0.7.0 strict_undefined render errors#243
lbliii merged 2 commits intomainfrom
lbliii/fix-submenu-children

Conversation

@lbliii
Copy link
Copy Markdown
Owner

@lbliii lbliii commented Apr 21, 2026

Summary

Kida 0.7.0's ?. operator raises on missing dict keys (it only short-circuits on None), so default-theme templates that accessed optional fields without a ?? fallback crashed on pages where those fields were absent — producing Build Error overlays for ~800 doc pages. Also discovered that Kida {% def %} macros always return Markup, not the raw {{ expr }} value, so parse_discover_config in doc/list.html was returning a Markup string that broke on .enabled access.

Changes

  • base.htmlrender_menu_item now extracts item?.children, item?.href, item?.name into locals with ?? fallbacks so auto_nav items (which lack children) render safely.
  • doc/list.html — replaced the parse_discover_config def with inline {% let %} expressions; added ?? none to discover?.children / discover?.related.
  • authors/single.html — switched all author.X to author?.X; page | author_view can return None.
  • partials/page-hero/_macros.html — wrapped page?.word_count, page?.date, params?.lastmod, params?.description, and _get_page_url in ?? fallbacks.
  • autodoc/openapi/partials/schema-viewer.html — added ?? none to schema?.enum, schema?.example, schema?.items.

Local build goes from 15 render errors / ~800 error-overlay pages → 0 render errors, 1486 pages rendered cleanly.

Test plan

  • Run bengal build --no-incremental in site/ and confirm zero [R010] render errors
  • Visually spot-check author pages, doc section pages, and autodoc pages in the built site

🤖 Generated with Claude Code

lbliii and others added 2 commits April 21, 2026 12:01
Kida 0.7.0's ?. operator raises on missing dict keys (it only short-circuits
on None), so templates that accessed optional dict/attribute fields without
a ?? fallback crashed on pages where those fields were absent. This affected
~800+ pages in the docs site (author pages without authors.yaml entries,
doc sections without discover: frontmatter, page heroes without lastmod).

Also: {% def %} macros always return Markup, not the raw {{ expr }} value —
parse_discover_config was returning a Markup string that looked like a dict
but failed on `.enabled` access. Refactored to inline `{% let %}` expressions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…hangelog

- test_bdi_in_base_menu now asserts on the post-refactor template strings
  (`<bdi>{{ _item_name }}</bdi>` and `<bdi>{{ child?.name ?? '' }}</bdi>`)
  introduced when render_menu_item was hardened for Kida 0.7.0
  strict_undefined.
- Add towncrier fragment describing the strict_undefined theme fixes so
  the `fragment` CI job stops failing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lbliii lbliii merged commit ed74299 into main Apr 21, 2026
22 checks passed
@lbliii lbliii deleted the lbliii/fix-submenu-children branch April 21, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant