The respective json then returns the meta-data of the posts having that tag.
For pagination of the tags, I created the following in theme/test-theme/layouts/tags/:
list.html
list.json
term.json
Unfortunately, that does not fully work as my theme just creates a /tags/<tag>/index.json, but no paginated ones. On the other hand, it creates the respective HTML files /tags/<tag>/page/1/index.html.
I do not know if there is maybe a general limitation of Hugo I am facing or if I am missing something.
git clone --single-branch -b hugo-forum-topic-55181 https://github.com/jmooring/hugo-testing hugo-forum-topic-55181
cd hugo-forum-topic-55181
hugo server
I haven’t read through all of your code, nor do I want to, but I can tell you with certainty that this will never work as intended:
{{- $currentPath := .RelPermalink -}}
{{- $pageNum := 1 -}}
{{/* Extract page number from URL if it exists */}}
{{- if strings.Contains $currentPath "/page/" -}}
{{- $pathParts := split $currentPath "/" -}}
{{- range $i, $part := $pathParts -}}
{{- if eq $part "page" -}}
{{- $pageNum = index $pathParts (add $i 1) | int -}}
{{- end -}}
{{- end -}}
{{- end -}}