{{ $maxCategories := 0 }}
{{ range $name, $taxonony := .Site.Taxonomies.categories }}
{{ $pageCt := len $taxonomy.Pages }}
{{ if gt $pageCt $maxCategories }}
{{ $maxCategories := $pageCt }}
{{ end }}
{{ end }}
this seems to “redeclare” a new maxCategories variable inside the range loop instead of setting the variable outside the loop. How do I make this work? Also, is there a better way to do “max” ?
Thank you. I spent an hour pouring over GoLang documentation, and trying to find hints of this in Hugo documentation, finally I gave up. This definitely needs to be in the documentation.
Documentation could always be improved, but this has been a hot topic on this forum, so I would be really surprised if it doesn’t show up in obvious searches.