| {{ $currentPost := . }} {{ $currentPostIndex := 1 }} {{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}} {{ $postsSorted := (sort $posts "Date" )}} {{ $postCounts := len $postsSorted }} {{ range $index, $element := $postsSorted }} {{ if eq $element.Title $currentPost.Title }} {{ $currentPostIndex = (add $index 1) }} {{ end }} {{ end }} {{ with .CurrentSection.Params.Code }} [{{ . }} {{ print $currentPostIndex }}/{{ print $postCounts }}] {{ end }} {{ .Title }}