Implement pre and post for menus.

https://gohugo.io/content-management/menus/
This commit is contained in:
tastytea 2021-07-16 22:22:59 +02:00
parent 0a10286c19
commit 21221ad721
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 8 additions and 4 deletions

View File

@ -3,6 +3,7 @@
<nav class="nav nav-bottom"{{- with .Site.Params.aria.menu_bottom }} aria-label="{{ . }}"{{- end }}>
<ul>
{{- range .Site.Menus.footer }}
{{ with .Pre }}{{ . }}{{ end }}
<li>
{{- if .URL }}
<a href="{{ .URL }}">{{ .Name }}</a>
@ -10,6 +11,7 @@
{{ .Name }}
{{- end }}
</li>
{{ with .Post }}{{ . }}{{ end }}
{{- end }}
{{- with .Site.Home.OutputFormats.Get "RSS" }}
<li>

View File

@ -8,13 +8,15 @@
<ul>
{{- $curr := . }}
{{- range .Site.Menus.main }}
{{- if .URL }}
{{ with .Pre }}{{ . }}{{ end }}
<li{{ with .Params.class }} class="{{ . }}"{{ end }}>
{{- if .URL }}
<a href="{{ .URL }}"{{ with .Title }} title="{{ . }}"{{ end }}>{{ .Name }}</a>
{{- else }}
<li>{{ .Name }}</li>
{{- end }}
</li>
{{- else }}
{{ .Name }}
{{- end }}
{{ with .Post }}{{ . }}{{ end }}
{{- end }}
</ul>
</nav>