{{- $count := .Get 0 | default 5 -}} {{- $url := printf "https://%s" site.Params.clapsHost -}} {{- $cacheKey := print $url (now.Format "-2006-01-02") -}} {{- with resources.GetRemote $url (dict "key" $cacheKey) -}} {{- with .Err -}} {{- errorf "%s" . -}} {{- else -}} {{- $data := .Content | transform.Unmarshal -}} {{- $claps := slice -}} {{- range $path, $count := $data -}} {{ $claps = $claps | append (dict "path" $path "count" $count) }} {{- end -}}
    {{- range (sort $claps "count" "desc" | first $count) -}} {{- $count := .count -}} {{- with site.GetPage .path -}} {{- $postType := partial "post-type.txt" . -}} {{- $typeSVG := index site.Params.defaultSVG ( partial "kebab.txt" $postType) -}}
  1. {{ partial "svg.html" (dict "name" $typeSVG) }} {{- with .Title -}}{{ . }}{{ else }}{{ .Type | singularize | title }}{{ end -}} {{ partial "svg.html" (dict "name" "clap") }} {{ $count }}
  2. {{- end -}} {{- end }}
{{- end -}} {{- else -}} {{- errorf "Unable to get all clap counts" -}} {{- end -}}