diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-26 18:56:03 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-26 18:56:03 +0200 |
| commit | 94ec68f7bc4a439b1373f754b202b0fa555b2d82 (patch) | |
| tree | a9d3ceead0bcae9d491ccf002ea9ddec1770c267 | |
| parent | 9073908fb5e33c895b162d0418d6e67246af539e (diff) | |
| download | danixxyz-theme-94ec68f7bc4a439b1373f754b202b0fa555b2d82.tar.gz danixxyz-theme-94ec68f7bc4a439b1373f754b202b0fa555b2d82.zip | |
fix: honor literal menu name on project submenu children
Submenu label logic treated child .Name strictly as an i18n key, so a
literal name set in a project page's [menus.main] block was swallowed
(fell through to the page title). Add a literal-name fallback after the
i18n lookup in both the desktop submenu (header.html) and the mobile
sub-list (hamburger-menu.html). Curated i18n entries (Packages) still
resolve via their key first.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rw-r--r-- | layouts/partials/hamburger-menu.html | 4 | ||||
| -rw-r--r-- | layouts/partials/header.html | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/layouts/partials/hamburger-menu.html b/layouts/partials/hamburger-menu.html index 0280ecb..e8b614b 100644 --- a/layouts/partials/hamburger-menu.html +++ b/layouts/partials/hamburger-menu.html @@ -49,8 +49,10 @@ {{ $label := "" }} {{ if $childExternal }} {{ $label = .Name }} - {{ else if and .Name (i18n .Name) }} + {{ else if and .Name (ne (i18n .Name) "") }} {{ $label = i18n .Name }} + {{ else if .Name }} + {{ $label = .Name }} {{ else if .Page }} {{ $label = .Page.LinkTitle }} {{ else }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 4ef817e..050f27f 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -115,13 +115,15 @@ {{ range .Children }} {{ $childExternal := .Params.external }} {{/* Curated entries (Packages) carry an i18n key as .Name; project - pages added via front-matter have no name, so fall back to the - page title. */}} + pages may set a literal menu name, else fall back to the page + title. */}} {{ $label := "" }} {{ if $childExternal }} {{ $label = .Name }} - {{ else if and .Name (i18n .Name) }} + {{ else if and .Name (ne (i18n .Name) "") }} {{ $label = i18n .Name }} + {{ else if .Name }} + {{ $label = .Name }} {{ else if .Page }} {{ $label = .Page.LinkTitle }} {{ else }} |
