Main menu: add pre/post properties support
This commit is contained in:
parent
6204d3ef0d
commit
f184b72d8d
1 changed files with 10 additions and 3 deletions
|
@ -11,9 +11,16 @@
|
||||||
<ul id="menu" class="main-nav__list{{ if eq .Site.Params.mainMenuAlignment "right" }} main-nav__list--right{{ end }}">
|
<ul id="menu" class="main-nav__list{{ if eq .Site.Params.mainMenuAlignment "right" }} main-nav__list--right{{ end }}">
|
||||||
{{- $currentNode := . }}
|
{{- $currentNode := . }}
|
||||||
{{- range sort .Site.Menus.main }}
|
{{- range sort .Site.Menus.main }}
|
||||||
{{- if .Name }}
|
{{- $current := (or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .)) }}
|
||||||
<li class="main-nav__item{{ if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }} main-nav__item--active{{ end }}">{{ if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }}{{ .Name }}{{ else }}<a class="main-nav__link" href="{{ .URL }}">{{ .Name }}</a>{{ end }}</li>
|
{{- if .Name }}
|
||||||
{{- end }}
|
<li class="main-nav__item{{ if $current }} main-nav__item--active{{ end }}">
|
||||||
|
{{ if not $current }}<a class="main-nav__link" href="{{ .URL }}">{{ end }}
|
||||||
|
{{ .Pre }}
|
||||||
|
<span class="main-nav__text">{{ .Name }}</span>
|
||||||
|
{{ .Post }}
|
||||||
|
{{ if not $current }}</a>{{ end }}
|
||||||
|
</li>
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
Loading…
Reference in a new issue