Skip to content

Commit

Permalink
remove global scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys committed Jul 9, 2020
1 parent 77b8930 commit 6754429
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions layouts/partials/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ <h1><a href="{{ .RelPermalink }}">{{ partial "title" . }}</a></h1>
</span>
</span>

{{ $.Scratch.Set "author-counter" 0 }}
{{ $ac := 0 }}
{{ with .Params.authors }}
{{ range sort . }}
{{ $ac := $.Scratch.Get "author-counter" }}
{{ $author := index $.Site.Data.authors . }}
{{ with $.Site.GetPage (printf "/authors/%s" $author.name | urlize) }}
{{ if eq $ac 0 }}
Expand All @@ -37,14 +36,13 @@ <h1><a href="{{ .RelPermalink }}">{{ partial "title" . }}</a></h1>
{{ template "post-author" dict "name" $author.name "page" . }}
{{ end }}
{{ end }}
{{ $.Scratch.Set "author-counter" (add $ac 1) }}
{{ add $ac 1 }}
{{ end }}
{{ end }}

{{ $.Scratch.Set "tag-counter" 0 }}
{{ $tc := 0 }}
{{ with .Params.tags }}
{{ range sort . }}
{{ $tc := $.Scratch.Get "tag-counter" }}
{{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
{{ if eq $tc 0 }}
Expand All @@ -56,7 +54,7 @@ <h1><a href="{{ .RelPermalink }}">{{ partial "title" . }}</a></h1>
{{ template "post-tag" dict "name" $name "page" . }}
{{ end }}
{{ end }}
{{ $.Scratch.Set "tag-counter" (add $tc 1) }}
{{ add $tc 1 }}
{{ end }}
{{ end }}
</footer>
Expand Down

0 comments on commit 6754429

Please sign in to comment.