layouts/_default/baseof.html: Update navbar menu template

Uses the same code as the Hugo menu template example, which should be
more robust with nested menus.
This commit is contained in:
Alan Orth 2018-03-09 20:29:11 +02:00
parent 74b3b2bfd8
commit cbd7140e63
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
1 changed files with 2 additions and 2 deletions

View File

@ -36,10 +36,10 @@
<div class="container">
<nav class="nav blog-nav">
<a class="nav-link {{ if .IsHome }}active{{ end }}" href="{{ .Site.BaseURL | absLangURL }}">{{ i18n "home" }}</a>
{{- $currentURL := .URL | absLangURL -}}
{{- $currentPage := . -}}
{{ range .Site.Menus.navbar }}
{{ $menuURL := .URL | absLangURL }}
<a class="nav-link{{ if eq $menuURL $currentURL }} active{{ end }}" href="{{.URL | absURL }}">{{ .Name }}</a>
<a class="nav-link{{ if or ($currentPage.IsMenuCurrent "navbar" .) ($currentPage.HasMenuCurrent "navbar" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ end }}
</nav>
</div>