fix active navbar tab
This commit is contained in:
parent
1bb99acfe6
commit
56f1f8c12f
|
@ -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/"
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue