How to conditionally apply html code after every 3 posts?

Hugo provides a modulo template func:

{{ range $k, $v :=  first 410 (.Data.Pages.ByDate.Reverse) }}  
    {{ if mod $k 3 | eq 0 }}
    {{ end }}
{{ end }}