fix page params loop

This commit is contained in:
Robert Kaussow 2020-07-06 21:59:33 +02:00
parent 8e2a80c8bd
commit ae40ac5bcb
Signed by: xoxys
GPG Key ID: 65362AE74AF98B61
1 changed files with 14 additions and 3 deletions

View File

@ -22,8 +22,11 @@
</span>
</span>
{{ range $i, $name := sort .Params.Authors }}
{{ $author := index $.Site.Data.authors $name }}
{{ $.Scratch.Set "author-counter" 0 }}
{{ with .Params.authors }}
{{ range sort . }}
{{ $i := $.Scratch.Get "author-counter" }}
{{ $author := index $.Site.Data.authors . }}
{{ with $.Site.GetPage (printf "/authors/%s" $author.name | urlize) }}
{{ if eq $i 0 }}
<span class="no-wrap">
@ -36,9 +39,15 @@
</span>
{{ end }}
{{ end }}
{{ $.Scratch.Set "author-counter" (add ($i) 1) }}
{{ end }}
{{ end }}
{{ range $i, $name := sort .Params.Tags }}
{{ $.Scratch.Set "tag-counter" 0 }}
{{ with .Params.tags }}
{{ range sort . }}
{{ $i := $.Scratch.Get "tag-counter" }}
{{ $name := . }}
{{ if eq $i 0 }}
<span class="no-wrap">
<svg class="icon menu"><use xlink:href="#tags"></use></svg>
@ -51,6 +60,8 @@
{{ if eq $i 0 }}
</span>
{{ end }}
{{ $.Scratch.Set "tag-counter" (add ($i) 1) }}
{{ end }}
{{ end }}
</footer>
</article>