mmh, not sure if this has any side effects or works for all cases or is completely the wrong track
but
- created your shortcode as
layouts/_shortcodes/next.html
- adding that multiple times to a Page (used content/_index.md)
{{<next>}}{{<next>}}{{<next>}}
- add this to the top of the
main
block of thelayouts/home.html
template
{{ if .HasShortcode "next" }}{{ .Store.Set "count" 0 }}{{ end }}
the counter will start at zero even on shortcode updates when running hugo server