Skip to content

Delimit function returns template.HTML, not string #10876

@willfaught

Description

@willfaught

https://gohugo.io/functions/delimit/:

Loops through any array, slice, or map and returns a string of all the values separated by a delimiter.

This:

{{ warnf "@@@@@@@@@@@@@@ %v %T" now.UnixNano $srcset }}
{{ warnf "@@@@@@@@@@@@@@ %v %T" now.UnixNano (printf "%s %fx" $resized.RelPermalink .) }}
{{ $srcset = $srcset | append (printf "%s %fx" $resized.RelPermalink .) }}
{{ warnf "@@@@@@@@@@@@@@ %v %T" now.UnixNano $srcset }}
{{ $srcset = delimit $srcset ", " }}
{{ warnf "@@@@@@@@@@@@@@ %v %T" now.UnixNano $srcset }}

prints this:

WARN 2023/04/04 23:00:21 @@@@@@@@@@@@@@ 1680674421963491000 []interface {}
WARN 2023/04/04 23:00:21 @@@@@@@@@@@@@@ 1680674421967981000 string
WARN 2023/04/04 23:00:21 @@@@@@@@@@@@@@ 1680674421968041000 []string
WARN 2023/04/04 23:00:21 @@@@@@@@@@@@@@ 1680674421968183000 template.HTML

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.111.3+extended darwin/amd64 BuildDate=unknown

Does this issue reproduce with the latest release?

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions