Go-Templates

How to Use Range, Where and Sort in Hugo

Various combinations of using range, where, first, sort, uniq, union, intersect, etc. in Hugo and Go Templates. Many are based on the Hugo Docs, but collected here in one place for easier access. Syntax Range range COLLECTION Where where COLLECTION KEY [OPERATOR] MATCH Sort Sorts slices, maps, and page collections. collections.Sort COLLECTION [KEY] [ORDER] Intersect Returns the common elements of two arrays or slices, in the same order as the first array.

View »