HUGO
News Docs Themes Community GitHub

collections.After

collections.After INDEX COLLECTION

Slices an array to the items after the Nth item.

collections.Append

collections.Append ELEMENT [ELEMENT...] COLLECTION

Appends one or more elements to a slice and returns the resulting slice.

collections.Apply

collections.Apply COLLECTION FUNCTION PARAM...

Returns a new collection with each element transformed by the given function.

collections.Complement

collections.Complement COLLECTION [COLLECTION...]

Returns the elements of the last collection that are not in any of the others.

collections.Delimit

collections.Delimit COLLECTION DELIMITER [LAST]

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

collections.Dictionary

collections.Dictionary [VALUE...]

Returns a map composed of the given key-value pairs.

collections.First

collections.First N COLLECTION

Returns the given collection, limited to the first N elements.

collections.Group

collections.Group KEY PAGES

Groups the given page collection by the given key.

collections.In

collections.In SET VALUE

Reports whether the given value is a member of the given set.

collections.Index

collections.Index COLLECTION KEY...

Returns the object, element, or value associated with the given key or keys.

collections.Intersect

collections.Intersect SET1 SET2

Returns the common elements of two arrays or slices, in the same order as the first array.

collections.IsSet

collections.IsSet COLLECTION KEY

Reports whether the key exists within the collection.

collections.KeyVals

collections.KeyVals KEY VALUE...

Returns a KeyVals struct.

collections.Last

collections.Last N COLLECTION

Returns the given collection, limited to the last N elements.

collections.Merge

collections.Merge MAP MAP...

Returns the result of merging two or more maps.

collections.NewScratch

collections.NewScratch

Returns a locally scoped "scratch pad" to store and manipulate data.

collections.Querify

collections.Querify [VALUE...]

Returns a URL query string composed of the given key-value pairs, encoded and sorted by key.

collections.Reverse

collections.Reverse COLLECTION

Reverses the order of a collection.

collections.Seq

collections.Seq LAST

Returns a slice of integers.

collections.Shuffle

collections.Shuffle COLLECTION

Returns a random permutation of a given array or slice.

collections.Slice

collections.Slice [VALUE...]

Returns a slice composed of the given values.

collections.Sort

collections.Sort COLLECTION [KEY] [ORDER]

Sorts slices, maps, and page collections.

collections.SymDiff

COLLECTION | collections.SymDiff COLLECTION

Returns the symmetric difference of two collections.

collections.Union

collections.Union SET1 SET2

Given two arrays or slices, returns a new array that contains the elements that belong to either or both arrays/slices.

collections.Uniq

collections.Uniq COLLECTION

Returns the given collection, removing duplicate elements.

collections.Where

collections.Where COLLECTION KEY [OPERATOR] VALUE

Returns the given collection, removing elements that do not satisfy the comparison condition.