Concatenating strings with print

This may be a horrible way of doing this, but I couldn’t find another way to concatenate strings in Hugo templates.

You can do it using print:

{{ $someVar = (print $someOtherVar " plus this") }}

I find this useful when I want to pass particular values to partials for re-use in a theme.

(Is there a better way of doing this?)


I think this is it.

I opened a pull requests to make this a bit more elegant

1 Like