IF condition and variable

If I understand currectly Golang doesn’t support followed code and probably “Scratch” may be the solution, but I do not know how to rewrite this. Help?

{{ if .IsHome }}
    {{- $paginator := .Paginate (where .Site.RegularPages "Section" "posts") -}}
    {{ else }}
    {{- $paginator := .Paginate .RegularPages -}}
    {{ end }}

https://pkg.go.dev/text/template#hdr-Variables

:= vs. =

It worked. I set empty variable with := and then set variables with =

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.