remove global scratch

This commit is contained in:
Robert Kaussow 2020-07-09 16:40:28 +02:00
parent 77b893063d
commit 67544294b9
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61

View File

@ -22,10 +22,9 @@
</span> </span>
</span> </span>
{{ $.Scratch.Set "author-counter" 0 }} {{ $ac := 0 }}
{{ with .Params.authors }} {{ with .Params.authors }}
{{ range sort . }} {{ range sort . }}
{{ $ac := $.Scratch.Get "author-counter" }}
{{ $author := index $.Site.Data.authors . }} {{ $author := index $.Site.Data.authors . }}
{{ with $.Site.GetPage (printf "/authors/%s" $author.name | urlize) }} {{ with $.Site.GetPage (printf "/authors/%s" $author.name | urlize) }}
{{ if eq $ac 0 }} {{ if eq $ac 0 }}
@ -37,14 +36,13 @@
{{ template "post-author" dict "name" $author.name "page" . }} {{ template "post-author" dict "name" $author.name "page" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $.Scratch.Set "author-counter" (add $ac 1) }} {{ add $ac 1 }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $.Scratch.Set "tag-counter" 0 }} {{ $tc := 0 }}
{{ with .Params.tags }} {{ with .Params.tags }}
{{ range sort . }} {{ range sort . }}
{{ $tc := $.Scratch.Get "tag-counter" }}
{{ $name := . }} {{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }} {{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
{{ if eq $tc 0 }} {{ if eq $tc 0 }}
@ -56,7 +54,7 @@
{{ template "post-tag" dict "name" $name "page" . }} {{ template "post-tag" dict "name" $name "page" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $.Scratch.Set "tag-counter" (add $tc 1) }} {{ add $tc 1 }}
{{ end }} {{ end }}
{{ end }} {{ end }}
</footer> </footer>