mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-14 01:00:41 +00:00
Robert Kaussow
3ccc8918bb
BREAKING CHANGE: The class `.icon` was renamed to `.gblog-icon` to avoid conflicts.
57 lines
1.6 KiB
HTML
57 lines
1.6 KiB
HTML
{{ $current := .current }}
|
|
{{ template "menu-file" dict "sect" .source "current" $current "site" $current.Site "target" .target }}
|
|
|
|
|
|
<!-- template -->
|
|
{{ define "menu-file" }}
|
|
{{ $current := .current }}
|
|
{{ $site := .site }}
|
|
{{ $target := .target }}
|
|
|
|
{{ range sort (default (seq 0) .sect) "weight" }}
|
|
{{ if isset . "ref" }}
|
|
{{ $this := $site.GetPage .ref }}
|
|
{{ $isCurrent := eq $current $this }}
|
|
{{ $icon := default false .icon }}
|
|
|
|
{{ if eq $target "footer" }}
|
|
<span class="gblog-footer__item gblog-footer__item--row">
|
|
{{ if $icon }}
|
|
<svg class="gblog-icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>
|
|
{{ end }}
|
|
<a
|
|
href="{{ if .external -}}
|
|
{{ .ref }}
|
|
{{- else -}}
|
|
{{ relref $current .ref }}
|
|
{{- end }}"
|
|
class="gblog-footer__link"
|
|
>
|
|
{{ .name }}
|
|
</a>
|
|
</span>
|
|
{{ else if eq $target "header" }}
|
|
<li>
|
|
<a
|
|
href="{{ if .external -}}
|
|
{{ .ref }}
|
|
{{- else -}}
|
|
{{ relref $current .ref }}
|
|
{{- end }}"
|
|
class="gblog-nav__entry{{ if $isCurrent }}{{ printf " %s" "is-active" }}{{ end }}"
|
|
>
|
|
<span class="flex align-center">
|
|
{{ if $icon }}
|
|
<svg class="gblog-icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>
|
|
{{ end }}
|
|
<span>
|
|
{{ .name }}
|
|
</span>
|
|
</span>
|
|
</a>
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|