urldecode
The string so it can be safely placed inside a URL query.
Read More »
urlencode
The string so it can be safely placed inside a URL query.
Read More »
.AddDate
Returns the time corresponding to adding the given number of years, months, and days to the given time.Time value.
Read More »
.Format
Returns a formatted time.Time value.
Read More »
.Get
Accesses positional and ordered parameters in shortcode declaration.
Read More »
.HasMenuCurrent
Reports whether the given page object matches the page object associated with one of the child menu entries under the given menu entry in the given menu.
Read More »
.IsMenuCurrent
Reports whether the given page object matches the page object associated with the given menu entry in the given menu.
Read More »
.Param
Returns a page parameter, falling back to a site parameter if present.
Read More »
.Render
Takes a view to apply when rendering content.
Read More »
.RenderString
Renders markup to HTML.
Read More »
.Scratch
Acts as a “scratchpad” to store and manipulate data.
Read More »
.Store
Returns a Scratch that is not reset on server rebuilds.
Read More »
.Unix
Converts a time.Time value to the number of seconds elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970.
Read More »
absLangURL
Returns an absolute URL with a language prefix, if any.
Read More »
absURL
Returns an absolute URL.
Read More »
after
Slices an array to the items after the Nth item.
Read More »
anchorize
Takes a string and sanitizes it the same way as the
defaultMarkdownHandler
does for markdown headers.
Read More »
append
Appends one or more elements to a slice and returns the resulting slice.
Read More »
apply
Returns a new collection with each element transformed by the given function.
Read More »
base64Decode
Returns the base64 decoding of the given content.
Read More »
base64Encode
Returns the base64 decoding of the given content.
Read More »
chomp
Removes any trailing newline characters.
Read More »
collections.Reverse
Reverses the order of a collection.
Read More »
complement
Returns the elements of the last collection that are not in any of the others.
Read More »
cond
Returns one of two arguments depending on the value of the control argument.
Read More »
countrunes
Returns the number of runes in a string excluding whitespace.
Read More »
countwords
Counts the number of words in a string.
Read More »
crypto.FNV32a
Returns the FNV (Fowler–Noll–Vo) 32 bit hash of a given string.
Read More »
debug.Dump
Returns an object dump as a string.
Read More »
default
Allows setting a default value that can be returned if a first value is not set.
Read More »
delimit
Loops through any array, slice, or map and returns a string of all the values separated by a delimiter.
Read More »
dict
Creates a map from a list of key and value pairs.
Read More »
duration
Returns a
time.Duration
structure, using the given time unit and duration number.
Read More »
echoParam
Prints a parameter if it is set.
Read More »
emojify
Runs a string through the Emoji emoticons processor.
Read More »
eq
Returns the boolean truth of arg1 == arg2 || arg1 == arg3.
Read More »
errorf
Log an ERROR from a template.
Read More »
erroridf
Log a suppressable ERROR from a template.
Read More »
fileExists
Reports whether the file or directory exists.
Read More »
findRE
Returns a slice of strings that match the regular expression.
Read More »
findRESubmatch
Returns a slice of all successive matches of the regular expression. Each element is a slice of strings holding the text of the leftmost match of the regular expression and the matches, if any, of its subexpressions.
Read More »
first
Slices an array to the first N elements.
Read More »
float
Casts a value to a decimal (base 10) floating point value.
Read More »
ge
Returns the boolean truth of arg1 >= arg2 && arg1 >= arg3.
Read More »
getCSV
Returns an array of arrays from a local or remote CSV file, or an error if the file does not exist.
Read More »
getenv
Returns the value of an environment variable, or an empty string if the environment variable is not set.
Read More »
getJSON
Returns a JSON object from a local or remote JSON file, or an error if the file does not exist.
Read More »
group
Groups a list of pages.
Read More »
gt
Returns the boolean truth of arg1 > arg2 && arg1 > arg3.
Read More »
highlight
Renders code with a syntax highlighter.
Read More »
hmac
Returns a cryptographic hash that uses a key to sign a message.
Read More »
htmlEscape
Returns the given string with the reserved HTML codes escaped.
Read More »
htmlUnescape
Returns the given string with HTML escape codes un-escaped.
Read More »
hugo
Provides global access to Hugo-related data.
Read More »
humanize
Returns the humanized version of an argument with the first letter capitalized.
Read More »
i18n
Translates a string using the translation tables in the i18n directory.
Read More »
Image filters
The images namespace provides a list of filters and other image related functions.
Read More »
index
Looks up the index(es) or key(s) of the data structure passed into it.
Read More »
int
Casts a value to a decimal (base 10) integer.
Read More »
intersect
Returns the common elements of two arrays or slices, in the same order as the first array.
Read More »
isset
Reports whether the key exists within the collection.
Read More »
jsonify
Encodes a given object to JSON.
Read More »
keyVals
Returns a KeyVals struct.
Read More »
lang.FormatAccounting
Returns a currency representation of a number for the given currency and precision for the current language in accounting notation.
Read More »
lang.FormatCurrency
Returns a currency representation of a number for the given currency and precision for the current language.
Read More »
lang.FormatNumber
Returns a numeric representation of a number with the given precision for the current language.
Read More »
lang.FormatNumberCustom
Returns a numeric representation of a number with the given precision using negative, decimal, and grouping options.
Read More »
lang.FormatPercent
Returns a percentage representation of a number with the given precision for the current language.
Read More »
lang.Merge
Merge missing translations from other languages.
Read More »
last
Slices an array to the last N elements.
Read More »
le
Returns the boolean truth of arg1 <= arg2 && arg1 <= arg3.
Read More »
len
Returns the length of a string, slice, map, or collection.
Read More »
lower
Converts all characters in the provided string to lowercase.
Read More »
lt
Returns the boolean truth of arg1 < arg2 && arg1 < arg3.
Read More »
markdownify
Renders markdown to HTML.
Read More »
math
Hugo provides mathematical operators in templates.
Read More »
md5
hashes the given input and returns its MD5 checksum.
Read More »
merge
Returns the result of merging two or more maps.
Read More »
ne
Returns the boolean truth of arg1 != arg2 && arg1 != arg3.
Read More »
newScratch
Creates a new Scratch which can be used to store values in a thread safe way.
Read More »
now
Returns the current local time
Read More »
os.Stat
Returns a FileInfo structure describing a file or directory.
Read More »
page
Provides global access to the .Page object.
Read More »
partial
Executes the named partial template. If the partial contains a return statement, returns that value, else returns the rendered output.
Read More »
partialCached
Allows for caching of partials that do not need to be re-rendered on every invocation.
Read More »
path.Base
Base returns the last element of a path.
Read More »
path.BaseName
BaseName returns the last element of a path, removing the extension if present.
Read More »
path.Clean
Replaces path separators with slashes (
/
) and removes extraneous separators.
Read More »
path.Dir
Dir returns all but the last element of a path.
Read More »
path.Ext
Ext returns the file name extension of a path.
Read More »
path.Join
Join path elements into a single path.
Read More »
path.Split
Split path immediately following the final slash.
Read More »
plainify
Returns a string with all HTML tags removed.
Read More »
pluralize
Pluralizes the given word according to a set of common English pluralization rules
Read More »
Prints the default representation of the given arguments using the standard
fmt.Print
function.
Read More »
printf
Formats a string using the standard
fmt.Sprintf
function.
Read More »
println
Prints the default representation of the given argument using the standard
fmt.Print
function and enforces a linebreak.
Read More »
querify
Takes a set or slice of key-value pairs and returns a query string to be appended to URLs.
Read More »
range
Iterates over slices, maps, and page collections.
Read More »
readDir
Returns an array of FileInfo structures sorted by file name, one element for each directory entry.
Read More »
readFile
Returns the contents of a file.
Read More »
ref
Returns the absolute permalink to a page.
Read More »
reflect.IsMap
Reports whether the value is a map.
Read More »
reflect.IsSlice
Reports whether the value is a slice.
Read More »
relLangURL
Returns a relative URL with a language prefix, if any.
Read More »
relref
Returns the relative permalink to a page.
Read More »
relURL
Returns a relative URL.
Read More »
replace
Replaces all occurrences of the search string with the replacement string.
Read More »
replaceRE
Returns a string, replacing all occurrences of a regular expression with a replacement pattern.
Read More »
safeCSS
Declares the provided string as a known “safe” CSS string.
Read More »
safeHTML
Declares a provided string as a “safe” HTML document to avoid escaping by Go templates.
Read More »
safeHTMLAttr
Declares the provided string as a safe HTML attribute.
Read More »
safeJS
Declares the provided string as a known safe JavaScript string.
Read More »
safeJSStr
Declares the provided string as a known safe JavaScript string.
Read More »
safeURL
Declares the provided string as a safe URL or URL substring.
Read More »
seq
Returns a slice of integers.
Read More »
sha1
Hashes the given input and returns its SHA1 checksum.
Read More »
sha256
Hashes the given input and returns its SHA256 checksum.
Read More »
shuffle
Returns a random permutation of a given array or slice.
Read More »
singularize
Converts a word according to a set of common English singularization rules.
Read More »
site
Provides global access to the .Site object.
Read More »
slice
Creates a slice (array) of all passed arguments.
Read More »
slicestr
Creates a slice of a half-open range, including start and end indices.
Read More »
sort
Sorts slices, maps, and page collections.
Read More »
split
Returns a slice of strings by splitting STRING by DELIM.
Read More »
string
Cast a value to a string.
Read More »
strings.Contains
Reports whether the string contains a substring.
Read More »
strings.ContainsAny
Reports whether a string contains any character from a given string.
Read More »
strings.ContainsNonSpace
Reports whether a string contains any non-space characters as defined by Unicode’s White Space property.
Read More »
strings.Count
Returns the number of non-overlapping instances of a substring within a string.
Read More »
strings.FirstUpper
Capitalizes the first character of a given string.
Read More »
strings.HasPrefix
Reports whether a string begins with prefix.
Read More »
strings.HasSuffix
Reports whether a string ends with suffix.
Read More »
strings.Repeat
Returns a new string consisting of zero or more copies of another string.
Read More »
strings.RuneCount
Returns the number of runes in a string.
Read More »
strings.TrimLeft
Returns a slice of a given string with all leading characters contained in the cutset removed.
Read More »
strings.TrimPrefix
Returns a given string s without the provided leading prefix string. If s doesn’t start with prefix, s is returned unchanged.
Read More »
strings.TrimRight
Returns a slice of a given string with all trailing characters contained in the cutset removed.
Read More »
strings.TrimSuffix
Returns a given string s without the provided trailing suffix string. If s doesn’t end with suffix, s is returned unchanged.
Read More »
substr
Extracts parts of a string from a specified character’s position and returns the specified number of characters.
Read More »
symdiff
Returns the symmetric difference of two collections.
Read More »
templates.Exists
Reports whether a template file exists under the given path relative to the
layouts
directory.
Read More »
time
Converts a timestamp string into a
time.Time
structure.
Read More »
time.Format
Returns a formatted and localized time.Time value.
Read More »
time.ParseDuration
Parses a given duration string into a
time.Duration
structure.
Read More »
title
Converts the provided string to title case.
Read More »
transform.CanHighlight
Reports whether the given code language is supported by the Chroma highlighter.
Read More »
transform.HighlightCodeBlock
Highlights code received in context within a code block render hook.
Read More »
transform.Remarshal
Marshals a string of serialized data, or a map, into a string of serialized data in the specified format.
Read More »
transform.Unmarshal
Parses the input and converts it into a map or an array. Supported formats are JSON, TOML, YAML, XML and CSV.
Read More »
trim
Returns a slice of a passed string with all leading and trailing characters from cutset removed.
Read More »
truncate
Truncates a text to a max length without cutting words or leaving unclosed HTML tags.
Read More »
union
Given two arrays or slices, returns a new array that contains the elements or objects that belong to either or both arrays/slices.
Read More »
uniq
Takes in a slice or array and returns a slice with duplicate elements removed.
Read More »
upper
Converts all characters in a string to uppercase
Read More »
urlize
Takes a string, sanitizes it for usage in URLs, and converts spaces to hyphens.
Read More »
urlquery
Returns the escaped value of the textual representation of its arguments in a form suitable for embedding in a URL query.
Read More »
urls.JoinPath
Joins the provided elements into a URL string and cleans the result of any ./ or ../ elements. If the argument list is empty, JoinPath returns an empty string.
Read More »
urls.Parse
Parses a URL into a URL structure.
Read More »
warnf
Log a WARNING from a template.
Read More »
where
Filters an array to only the elements containing a matching value for a given field.
Read More »
with
Rebinds the context (
.
) within its scope and skips the block if the variable is absent or empty.
Read More »