Move site navigation to a partial

It can now be shared between the index and site header templates.
This commit is contained in:
Eryn Wells 2023-05-20 08:27:55 -07:00
parent 52a79500c0
commit 1713d5f849
4 changed files with 11 additions and 19 deletions

View file

@ -5,13 +5,7 @@
<h1 class="site">
<a class="site-name" href="{{ `` | absURL }}">{{ partial "site_name.html" site.Params.shortTitle }}</a>
</h1>
<nav class="site bulleted">
{{ with site.Menus.main }}
{{- range . -}}
<li><a {{ if $currentPage.HasMenuCurrent "main" . }} class="active"{{ end }} href="{{ .URL }}"><span>{{ .Name }}</span></a></li>
{{- end -}}
{{ end }}
</nav>
{{ partial "site_nav.html" . }}
<nav class="social">
{{ with site.Menus.social }}
{{- range . -}}

View file

@ -0,0 +1,9 @@
{{- $currentPage := . -}}
{{- $url := $.RelPermalink -}}
<nav class="site bulleted">
{{ with site.Menus.main }}
{{- range . -}}
<li><a {{ if $currentPage.HasMenuCurrent "main" . }} class="active"{{ end }} href="{{ .URL }}"><span>{{ .Name }}</span></a></li>
{{- end -}}
{{ end }}
</nav>