summaryrefslogtreecommitdiffstats
path: root/themes
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-04-22 11:40:47 +0200
committerDanilo M. <danix@danix.xyz>2026-04-22 11:40:47 +0200
commit3e568636ea564606abddcd05288d06e036a5efe4 (patch)
tree4dc055ce25d3f98be7934a2856a53f4bb862a319 /themes
parenteabf31e28a25eb3c9e120d5212f1130f388d9522 (diff)
downloaddanixxyz-3e568636ea564606abddcd05288d06e036a5efe4.tar.gz
danixxyz-3e568636ea564606abddcd05288d06e036a5efe4.zip
feat: add active state highlight to desktop nav links
Apply same active-page detection logic used in hamburger menu to desktop navigation. Desktop nav now shows purple accent color + bold font and aria-current=page attribute when viewing the linked page. Works for both EN and IT languages.
Diffstat (limited to 'themes')
-rw-r--r--themes/danix-xyz-hacker/layouts/partials/header.html9
1 files changed, 8 insertions, 1 deletions
diff --git a/themes/danix-xyz-hacker/layouts/partials/header.html b/themes/danix-xyz-hacker/layouts/partials/header.html
index 739c776..914e645 100644
--- a/themes/danix-xyz-hacker/layouts/partials/header.html
+++ b/themes/danix-xyz-hacker/layouts/partials/header.html
@@ -12,8 +12,15 @@
<!-- Desktop menu (hidden on mobile) -->
<div class="hidden md:flex items-center gap-8">
+ {{ $currentPath := strings.TrimSuffix "/" .RelPermalink }}
{{ range .Site.Menus.main }}
- <a href="{{ .URL }}" class="text-sm hover:text-accent transition-colors">
+ {{ $menuPath := strings.TrimSuffix "/" .URL }}
+ {{ $isActive := eq $menuPath $currentPath }}
+ <a
+ href="{{ .URL }}"
+ class="text-sm transition-colors {{ if $isActive }}text-accent font-bold{{ else }}hover:text-accent{{ end }}"
+ {{ if $isActive }}aria-current="page"{{ end }}
+ >
{{ i18n .Name }}
</a>
{{ end }}