urls.Parse
Parse parses a given url, which may be relative or absolute, into a URL structure.
Read More »
ge
Returns the boolean truth of arg1 >= arg2.
Read More »
gt
Returns the boolean truth of arg1 > arg2.
Read More »
le
Returns the boolean truth of arg1 <= arg2.
Read More »
lt
Returns the boolean truth of arg1 < arg2.
Read More »
ne
Returns the boolean truth of arg1 != arg2.
Read More »
imageConfig
Parses the image and returns the height, width, and color model.
Read More »
.AddDate
Returns the time corresponding to adding the given number of years, months, and days passed to the function.
Read More »
.Format
Formats built-in Hugo dates—
.Date
, .PublishDate
, and .LastMod
—according to Go’s layout string.
Read More »
.Get
Accesses positional and ordered parameters in shortcode declaration.
Read More »
.Param
Calls page or site variables into your template.
Read More »
.Scratch
Acts as a “scratchpad” to allow for writable page- or shortcode-scoped variables.
Read More »
.Unix
.Unix returns the local Time corresponding to the given Unix time, sec seconds and nsec nanoseconds since January 1, 1970 UTC.
Read More »
Math
Hugo provides nine mathematical operators in templates.
Read More »
absLangURL
Adds the absolute URL with correct language prefix according to site configuration for multilingual.
Read More »
absURL
Creates an absolute URL based on the configured baseURL.
Read More »
after
after
slices an array to only the items after the Nth item.
Read More »
apply
Given a map, array, or slice,
apply
returns a new slice with a function applied over it.
Read More »
base64
base64Encode
and base64Decode
let you easily decode content with a base64 encoding and vice versa through pipes.
Read More »
chomp
Removes any trailing newline characters.
Read More »
countrunes
Determines the number of runes in a string excluding any whitespace.
Read More »
countwords
Counts the number of words in a string.
Read More »
dateFormat
Converts the textual representation of the
datetime
into the specified format.
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 dictionary from a list of key and value pairs.
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.
Read More »
findRE
Returns a list of strings that match the regular expression.
Read More »
first
Slices an array to only the first N elements.
Read More »
getenv
Returns the value of an environment variable.
Read More »
hasPrefix
Tests whether a string begins with prefix.
Read More »
highlight
Takes a string of code and language declaration and uses Pygments to return syntax-highlighted HTML with inline-styles.
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 »
humanize
Returns the humanized version of an argument with the first letter capitalized.
Read More »
i18n
Translates a piece of content based on your i18n configuration files.
Read More »
in
Checks if an element is in an array or slice–or a substring in a string—and returns a boolean.
Read More »
index
Looks up the index(es) or key(s) of the data structure passed into it.
Read More »
int
Creates an
int
from the argument passed into the function.
Read More »
intersect
Returns the common elements of two arrays or slices.
Read More »
isset
Returns true if the parameter is set.
Read More »
jsonify
Encodes a given object to JSON.
Read More »
lang.NumFmt
Formats a number with a given precision using the requested
negative
, decimal
, and grouping
options. The options
parameter is a string consisting of <negative> <decimal> <grouping>
.
Read More »
last
slices an array to only the last Nth elements.
Read More »
len
Returns the length of a variable according to its type.
Read More »
lower
Converts all characters in the provided string to lowercase.
Read More »
markdownify
Runs the provided string through the Markdown processor.
Read More »
md5
hashes the given input and returns its MD5 checksum.
Read More »
now
Returns the current local time
Read More »
partialCached
Allows for caching of partials that do not need to be re-rendered on every invocation.
Read More »
plainify
Strips any HTML and returns the plain text version of the provided string.
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 argument 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 of key-value pairs and returns a query string to be appended to URLs.
Read More »
range
Iterates over a map, array, or slice.
Read More »
readDir
Gets a directory listing from a directory relative to the current working directory.
Read More »
readFile
Reads a file from disk relative to the current project working directory and returns a string.
Read More »
ref
Looks up a content page by logical name.
Read More »
relLangURL
Adds the relative URL with correct language prefix according to site configuration for multilingual.
Read More »
relURL
Given a string, prepends the relative URL according to a page’s position in the project directory structure.
Read More »
relref
Looks up a content page by relative path.
Read More »
render
Takes a view to apply when rendering content.
Read More »
replace
Replaces all occurrences of the search string with the replacement string.
Read More »
replaceRE
Replaces all occurrences of a regular expression with the 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 »
safeURL
Declares the provided string as a safe URL or URL substring.
Read More »
seq
Creates a sequence of integers.
Read More »
sha
Hashes the given input and returns either an SHA1 or 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 »
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 maps, arrays, and slices and returns a sorted slice.
Read More »
split
splits a string into substrings separated by a delimiter
Read More »
string
Creates a string from the argument passed to the function
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 »
time
Converts a timestamp string into a
time.Time
structure.
Read More »
title
Converts all characters in the provided string to title case.
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 subsequent 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 »
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.
Read More »