slice

将以下英文翻译为中文:

slice

https://gohugo.io/functions/slice/

Creates a slice (array) of all passed arguments.

语法

slice ITEM...

One use case is the concatenation of elements in combination with the delimit function:

slice.html

1
2
3
4
{{ $sliceOfStrings := slice "foo" "bar" "buzz" }}
<!-- returns the slice [ "foo", "bar", "buzz"] -->
{{ delimit ($sliceOfStrings) ", " }}
<!-- returns the string "foo, bar, buzz" -->