fix active navbar tab

This commit is contained in:
a 2021-10-17 23:03:36 -05:00
parent 1bb99acfe6
commit 56f1f8c12f
2 changed files with 10 additions and 7 deletions

View file

@ -12,14 +12,14 @@ category = "category"
[menu]
[[menu.main]]
identifier = "home"
identifier = ""
pre = "<i class='fa fa-home' aria-hidden='true'></i>"
name = "Home"
url = "/"
weight = 10
[[menu.main]]
identifier = "experience"
identifier = "work"
pre = "<i class='fa fa-briefcase' aria-hidden='true'></i>"
name = "Work"
url = "/work/"
@ -44,4 +44,4 @@ identifier = "blog"
pre = "<i class='fa fa-pencil' aria-hidden='true'></i>"
name = "Blog"
url = "/blog/"
weight = 50
weight = 50

View file

@ -6,16 +6,19 @@
</a>
<nav class="site-nav">
<ul>
{{- $currentPage := . -}}
{{ range .Site.Menus.main -}}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<li class='
{{ if or ($currentPage.IsMenuCurrent "main" .) (eq $currentPage.Section .Identifier) }}
active
{{ end }}'>
<a href="{{ .URL | absLangURL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
{{ .Post }}
</a>
</li>
{{- end }}
{{ end }}
</ul>
{{ partial "i18nlist.html" . }}
</nav>