Updating nav bar to only display when there are menu items in the config file
This commit is contained in:
parent
c1bcf8c340
commit
3675771935
4 changed files with 124 additions and 10 deletions
|
@ -4,7 +4,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="referrer" content="no-referrer-when-downgrade">
|
||||
|
||||
<title>{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{end}}</title>
|
||||
<title>{{ if .Title }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
|
||||
<meta name="description" content="{{ .Site.Params.Description }}">
|
||||
|
||||
{{ with .OutputFormats.Get "rss" -}}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
<h1 class="site-title">
|
||||
<a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a>
|
||||
</h1>
|
||||
<nav>
|
||||
{{ $currentPage := . }}
|
||||
{{ range .Site.Menus.main }}
|
||||
<a class="{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ if .Site.Menus }}
|
||||
<nav>
|
||||
{{ $currentPage := . }}
|
||||
{{ range .Site.Menus.main }}
|
||||
<a class="{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ else }}
|
||||
<nav></nav>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue