Reference
Template functions
The functions SiteGen adds to Go templates, for data, lists, pages and output.
These work alongside Go's built-in template functions, such as eq, len and printf. Select a function for its details and an example.
Content
data "file.json"
Load and parse a JSON file from the data directory.
sources "property" "glob"
List source files whose property matches a glob.Lists
sort "property" "asc|desc" list
Sort sources, JSON objects or key/value pairs.
filter "property" "regex" list
Keep the items whose property matches a regular expression.
limit n list
Take the first n items of a list.
offset n list
Skip the first n items of a list.
select map
Turn a JSON object into a list of key/value pairs.Pages
paginate n list
Split a list across numbered pages.
pages .Source
Links for a paginated listing.
page "source" "slug"
Generate a page from a template file, once per slug.
path "/url"
Prefix a URL with the base path.
hash "/file"
A short content hash of a source file, for cache-busting asset URLs.