asw/site/layouts/partials/nav.html
Vigilio Desto defcb22cc4
Fix Hugo build: nav.html used invalid hugo.Data syntax, fix deploy.sh path
nav.html: hugo.Data.nav.items → .Site.Data.nav.items (hugo.Data is not
a valid accessor for data files in any Hugo version).

deploy.sh: run hugo from site/ subdir, output to public/ at repo root
where nginx expects it. Use /usr/local/bin/hugo (v0.147.4) explicitly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 13:54:34 +02:00

29 lines
1.1 KiB
HTML

<nav>
<ul><li><a href="/"><strong>{{ .Site.Title }}</strong></a></li></ul>
<ul data-nav-links>
{{- range sort .Site.Data.nav.items "weight" }}
<li><a href="{{ .url }}"{{ if eq (relURL .url) $.RelPermalink }} aria-current="page"{{ end }}>{{ .name }}</a></li>
{{- end }}
</ul>
<button data-nav-toggle aria-label="Menu" hidden></button>
<button data-theme-toggle aria-label="Toggle theme"></button>
</nav>
<script>
// Hamburger — toggle nav links on mobile
(function(){
var btn = document.querySelector('[data-nav-toggle]');
var links = document.querySelector('[data-nav-links]');
if (!btn || !links) return;
// Show button only when JS is available
if (matchMedia('(max-width:767.98px)').matches) btn.hidden = false;
matchMedia('(max-width:767.98px)').addEventListener('change', function(e) {
btn.hidden = !e.matches;
if (!e.matches) links.removeAttribute('data-collapsed');
});
btn.addEventListener('click', function() {
var open = links.hasAttribute('data-collapsed');
if (open) links.removeAttribute('data-collapsed');
else links.setAttribute('data-collapsed', '');
});
})();
</script>