mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-12-19 09:02:18 +01:00
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:
parent
74b3b2bfd8
commit
cbd7140e63
@ -36,10 +36,10 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<nav class="nav blog-nav">
|
<nav class="nav blog-nav">
|
||||||
<a class="nav-link {{ if .IsHome }}active{{ end }}" href="{{ .Site.BaseURL | absLangURL }}">{{ i18n "home" }}</a>
|
<a class="nav-link {{ if .IsHome }}active{{ end }}" href="{{ .Site.BaseURL | absLangURL }}">{{ i18n "home" }}</a>
|
||||||
{{- $currentURL := .URL | absLangURL -}}
|
{{- $currentPage := . -}}
|
||||||
{{ range .Site.Menus.navbar }}
|
{{ range .Site.Menus.navbar }}
|
||||||
{{ $menuURL := .URL | absLangURL }}
|
{{ $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 }}
|
{{ end }}
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user