mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-11-17 09:47:05 +01:00
highlights the current navbar menu entry
This commit is contained in:
parent
eed60d8a8d
commit
e811b25fdc
@ -35,13 +35,16 @@
|
||||
<div class="container">
|
||||
<nav class="nav blog-nav">
|
||||
<a class="nav-link {{ if .IsHome }}active{{ end }}" href="{{ .Site.BaseURL | absLangURL }}">{{ i18n "home" }}</a>
|
||||
{{ $currentRelURL := .URL | relLangURL }}
|
||||
{{ if .Site.Params.custom_navbar }}
|
||||
{{ range .Site.Menus.navbar }}
|
||||
<a class="nav-link" href="{{.URL | absURL }}">{{ .Name }}</a>
|
||||
{{ $menuRelURL := .URL | relLangURL }}
|
||||
<a class="nav-link {{ if eq $menuRelURL $currentRelURL }}active{{ end }}" href="{{.URL | absURL }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ range where .Site.RegularPages "Type" "!=" "post" }}
|
||||
<a class="nav-link" href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
{{ $permalinkRelURL := .Permalink | relLangURL }}
|
||||
<a class="nav-link {{ if eq $permalinkRelURL $currentRelURL }}active{{ end }}" href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
Loading…
Reference in New Issue
Block a user