Delimit and markdownify together?


I have this code:

{{ delimit .Params.authors ", " " and " }}

where authors is a list of strings.

I want to also use Markdownify to add links to the authors websites, so it would be:

authors = ["[Name 1](", "[Name 2]("]

However, if I add Mardownify to the code, it doesn’t work. I tried:

    {{ delimit .Params.authors | markdownify ", " " and " }}
    {{ delimit .Params.authors ", " " and " | markdownify }}
    {{ with .Params.authors }}
    {{ delimit . ", " " and "  | markdownify}}
    {{ end }}

It complains that .Params.authors is a list and not a string or that delimit gets more arguments than it should.

I’m new at gohugo (which I find amazing) so be gentle :slightly_smiling:

It should work like this:

{{ delimit .Params.authors ", " " and " | markdownify }}

What does that give you?

Hi, I get:

Error while rendering page publication\ template: theme/publication/single.html:9:58: executing "theme/publication/single.html" at <markdownify>: wrong type for value; expected string; got template.HTML

I’m wondering if we’ve fixed that in 0.16-DEV, but try this:

{{ printf "%v" (delimit .Params.authors ", " " and ") | markdownify }}

Thanks! It worked like charm :slightly_smiling:

I use the 0.15 version.

Hai @moorereason and @apetros
i got, similar error while building my site, may i know where should we add the above code, thanks in advance

Start a new thread and provide more details of exactly what you’re doing and the error message you receive. Also include the output of hugo version.