ERROR when piping absURL or relURL

Hello,

I’m trying to render this onto one of my single html pages

{{ .Params.img | absURL }}

or this one

{{ .Params.img | relURL }}

but i keep getting and error stating: “wrong number of args for absURL: want 1 got 0”

Your second example is missing the dot in front of Params.

The syntax seems correct overall so it’s difficult to say what’s going on .

You need to post a link to your Hugo project.

Simply one of your posts is missing the img param in front-matter?

It’s always better to use with in such cases:

{{ with .Params.img }}
    {{ . | absURL }}
{{ end }}
2 Likes

thanks this was very helpfull