You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For {{< myshortcode "bar" >}}, "bar" <nil> is logged.
For {{< myshortcode other="bar" >}}, <nil> "" is logged.
Note how the second value logged varies between cases, despite .Get "foo" not being assigned an argument in either case.
It didn’t cause a problem for me directly, but my concern is that someone might think that {{ if ne (.Get "foo") "" }} or {{ if ne (.Get "foo") nil }} are correct, when they might not be, depending on the argument syntax. The API should be clear and consistent on the values, regardless of whether {{ if .Get "foo" }} is the primary way of checking for given values.
It should be nil in both cases.
For example, given this shortcode:
For
{{< myshortcode "bar" >}}
,"bar" <nil>
is logged.For
{{< myshortcode other="bar" >}}
,<nil> ""
is logged.Note how the second value logged varies between cases, despite
.Get "foo"
not being assigned an argument in either case.It didn’t cause a problem for me directly, but my concern is that someone might think that {{ if ne (.Get "foo") "" }} or {{ if ne (.Get "foo") nil }} are correct, when they might not be, depending on the argument syntax. The API should be clear and consistent on the values, regardless of whether {{ if .Get "foo" }} is the primary way of checking for given values.
See https://discourse.gohugo.io/t/bug-using-get-with-non-existent-params-returns-an-empty-string-instead-of-nil/42593/2 for the full context.
What version of Hugo are you using (
hugo env
)?Does this issue reproduce with the latest release?
Yes
The text was updated successfully, but these errors were encountered: