Inject a div every 5th position in the post list

This is the code I use to display posts on my index page:

      {{ $paginator := .Paginate (where (where .Site.RegularPages "Section" "blog") ".Params.unlisted" "!=" true) }}
      {{ range $paginator.Pages }}
          {{ partial "article-card.html" . }}
      {{ end }}

Now I want to add to this one more element - every 5th position, I want to display a <div>Some HTML content</div>. How can I inject it?

Hi, I think this thread solves a similar problem, it might help you.

2 Likes