Skip to content

fix(nav): guard postNav against nil main menu - #26

Merged
jjsnack merged 1 commit into
mainfrom
fix/postnav-nil-menu-guard
Aug 15, 2026
Merged

fix(nav): guard postNav against nil main menu#26
jjsnack merged 1 commit into
mainfrom
fix/postnav-nil-menu-guard

Conversation

@jjsnack

@jjsnack jjsnack commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • `postNav.html` computed `len($menus)` directly, which panics when `Site.Menus.main` is nil (e.g. `404.html`, or any content-less/no-menu site).
  • `nav.html` was already patched for this in `fix/nil-menu-guard` ("Guard nav against nil menu on content-less sites"), but `postNav.html` was added afterward without the same guard.
  • Mirrors the existing `with`-guarded pattern from `nav.html`.

Test plan

  • `hugo --gc --minify -D` in a site with no `main` menu configured now builds clean (was previously failing with error calling len: reflect: call of reflect.Value.Type on zero Value in postNav.html)

postNav.html computed len($menus) directly, panicking when
Site.Menus.main is nil (e.g. 404.html, or any content-less site).
nav.html was already patched for this in fix/nil-menu-guard, but
postNav.html was added afterward without the same guard.
@jjsnack
jjsnack merged commit a72bf8e into main Aug 15, 2026
3 checks passed
@jjsnack
jjsnack deleted the fix/postnav-nil-menu-guard branch August 15, 2026 05:29
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