Another minor issue I came across:
I’m fetching local resources via resources.Get
:
{{ $image := resources.Get "box.png" "invalidSecondArgument"}}
With this code, I’m getting an error::
execute of template failed at <resources>: wrong number of args for Get: want 1 got 2
However, fetching remote resources via resources.GetRemote
, passing a third argument does not result in an error:
{{- with resources.GetRemote "https://httpbin.org/get" ( dict "method" "post" ) "third_argument" }}
<a href="{{- .RelPermalink -}}">JSON</a> from httpbin
{{ end}}
Question: Does resources.GetRemote
take more than two arguments? If not, hugo should validate the number of arguments given (as with resources.Get
).
Practical use: see this code:
{{- with resources.GetRemote "https://httpbin.org/get" dict "method" "post" }}
{{ end}}
Due to missing parenthesis, this code does not what it is supposed to (specifying a options dict
), potentially confusing users. With validation for number of arguments in place, this code would result in an error.