I want to be able to display the total number of posts in a range on each element with a $postCount variable like so (it’s obvs 5 in this case but yeh):
{{ range $index, $element := first 5 (where .Data.Pages “Type” “work”) }}
{{ $index }}/{{ $postCount }}
{{ end }}
It seems I need to use the len function I’m just not quite sure what to do with it.
Not sure if this will help. I have this in a shortcode and I show it on my front page:
{{/* Show a count of pages by different types */}}
<p>
There are {{ len .Site.RegularPages }} pages currently on this site.
{{ len (where .Site.RegularPages "Section" "=" "posts") }} <a href="/posts">blog posts</a>,
{{ len (where .Site.RegularPages "Section" "=" "kb") }} <a href="/kb">knowledgebase pages</a>,
{{ len (where .Site.RegularPages "Section" "=" "about") }} <a href="/about"><em>about</em> pages</a>
and {{ len (where .Site.RegularPages "Section" "=" "projects") }} <a href="/projects">project pages</a>.
</p>