need to accomplish a layout with a link to next and previous post and a counter marking the actual post, bad representation ahead:
<previousPost 10/100 nextPost>
I put everything to work, except the mention of the current post number:
{{ $posts := (where .Site.RegularPages "Section" "==" "news") }}
{{ $postCount := len $posts }}
{{ if .PrevInSection }}
<a href="{{.PrevInSection.Permalink}}">Prev Post</a>
{{ end }}
{{ I have no idea }}/{{ $postCount }}
{{ if .NextInSection }}
<a href="{{.NextInSection.Permalink}}">Next Post</a>
{{ end }}
And I have no clue on how to find the value of the page in the netxInSection context. I’m thinking about changing my code to a range and use the index to mark the current page but I think that should be a smarter way.
Happy to. Looking at the range page, it’s pretty sparse. Do you think there’s a more appropriate place for it? I think logically I’d pair it with len as I can imagine a major use case would be a variation of:
You are viewing page Index of Total
Or maybe even a progress meter (ie: a percentage of the two) - my use-case is both.