Anybody tried to insert {{ hugo.IsProduction }} on _content.gotmpl for the load of the json file ?
Tried to use the code below, but it trows can't evaluate field isProduction in type interface {}
{{ if hugo.IsProduction }}
{{ $url := "data/bigfile.json" }}
{{ else }}
{{ $url := "data/smallfile.json" }}
{{ end }}
You have a scope problem. A variable initialized (:=) within an if, with, or range block is only available within the block. You need to initialize outside of the block, then assign (=) within the block.
{{ $url := "data/smallfile.json" }}
{{ if hugo.IsProduction }}
{{ $url = "data/bigfile.json" }}
{{ end }}