getJSON is supposed to return nil when an error occures, we’ve tried to test our var against nil in the following way but still hugo crash on with an error on getJSON
ERROR 2018/05/23 18:12:13 Error while rendering “page” in “ville/”: template:…/single.html:144:11: executing “main” at <partial "block-local…>: error calling partial: template: theme/partials/block-local-.html:64:21: executing “theme/partials/block-local.html” at <getJSON ($.Scratch.G…>: error calling getJSON: Get http://127.0.0.1//test.md: EOF
In our template
{{ dataJSON := (getJSON (.Scratch.Get “baseurlapi”) $element) }}
{{ if ne $dataJSON nil }}
Wow! I am still using Hugo, but I believe I haven’t updated it in about that much time. Now’s a good reason, at least for me, to update it on the next release