我在 join two strings 找到了这个文档,但这在 go 模板中不起作用。
有没有办法在 go 模板中连接字符串?
最佳答案
使用 delimit
和 slice
的组合,例如
{{ delimit (slice "foo" "bar" "buzz") ", " }}
<!-- returns the string "foo, bar, buzz" -->
最初来自gohugo docs
https://stackoverflow.com/questions/39023060/