path.BaseName
BaseName returns the last element of a path, removing the extension if present.
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 »
path.Clean
Replaces path separators with slashes (
/
) and removes extraneous separators.
Read More »
lang
TODO..
Read More »
strings.Count
Returns the number of non-overlapping instances of a substring within a string.
Read More »
hmac
Returns a cryptographic hash that uses a key to sign a message.
Read More »
.RenderString
Renders markup to HTML.
Read More »
strings.HasSuffix
Determine whether a given string ends with the provided trailing suffix string.
Read More »
merge
Returns the result of merging two or more maps.
Read More »
hugo
The
hugo
function provides easy access to Hugo-related data.
Read More »
transform.Unmarshal
transform.Unmarshal
(alias unmarshal
) parses the input and converts it into a map or an array. Supported formats are JSON, TOML, YAML, XML and CSV.
Read More »
path.Base
Base returns the last element of a path.
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 »
reflect.IsMap
Reports if a value is a map.
Read More »
reflect.IsSlice
Reports if a value is a slice.
Read More »
symdiff
collections.SymDiff
(alias symdiff
) returns the symmetric difference of two collections.
Read More »
templates.Exists
Checks whether a template file exists under the given path relative to the
layouts
directory.
Read More »
anchorize
Takes a string and sanitizes it the same way as the
defaultMarkdownHandler
does for markdown headers.
Read More »
append
append
appends one or more values to a slice and returns the resulting slice.
Read More »
group
group
groups a list of pages.
Read More »
os.Stat
Returns a FileInfo structure describing a file or directory.
Read More »
strings.RuneCount
Determines the number of runes in a string.
Read More »
strings.Repeat
Returns INPUT repeated COUNT times.
Read More »
lang.Merge
Merge missing translations from other languages.
Read More »
errorf and warnf
Log ERROR or WARNING from the templates.
Read More »
float
Creates a
float
from the argument passed into the function.
Read More »
urls.Parse
Parse parses a given url, which may be relative or absolute, into a URL structure.
Read More »
cond
Return one of two arguments, depending on the value of a third argument.
Read More »
fileExists
Checks for file or directory existence.
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 »
.AddDate
Returns the time corresponding to adding the given number of years, months, and days to the given time.Time value.
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 »
.HasMenuCurrent
.HasMenuCurrent is a method in Page object returning a boolean value. It returns true if the PAGE is the same object as the .Page in one of the children menu entries under MENUENTRY in a given MENU.
If MENUENTRY’s .Page is a section then, from Hugo 0.86.0, this method also returns true for any descendant of that section..
You can find its example use in menu templates.
Read More »
.IsMenuCurrent
.IsMenuCurrent is a method in Page object returning a boolean value. It returns true if the PAGE is the same object as the .Page in MENUENTRY in a given MENU.
You can find its example use in menu templates.
Read More »
.Param
Calls page or site variables into your template.
Read More »
.Render
Takes a view to apply when rendering content.
Read More »
.Scratch
Acts as a “scratchpad” to store and manipulate data.
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 »
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 »
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 »
first
Slices an array to only the first N elements.
Read More »
getenv
Returns the value of an environment variable, or an empty string if the environment variable is not set.
Read More »
hasPrefix
Tests whether a string begins with prefix.
Read More »
highlight
Renders code with a syntax highlighter.
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 »
Image Filters
The images namespace provides a list of filters and other image related functions.
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, in the same order as the first array.
Read More »
isset
Returns true if the parameter is set.
Read More »
jsonify
Encodes a given object to JSON.
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 »
Math
Hugo provides mathematical operators in templates.
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 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 a map, array, or slice.
Read More »
readDir
Returns an array of FileInfo structures sorted by filename, 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 »
relref
Returns the relative permalink to a page.
Read More »
replace
Replaces all occurrences of the search string with the replacement string.
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 »
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
Returns a slice of strings by splitting STRING by DELIM.
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 »
time.Format
Converts a date/time to a localized string.
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 or empty.
Read More »
absLangURL
Returns an absolute URL with a language prefix, if any.
Read More »
absURL
Returns an absolute URL.
Read More »
complement
Returns the elements of the last collection that are not in any of the others.
Read More »
crypto.FNV32a
Returns the FNV (Fowler–Noll–Vo) 32 bit hash of a given string.
Read More »
duration
Returns a
time.Duration
structure, using the given time unit and duration number.
Read More »
findRE
Returns a slice of strings that match the regular expression.
Read More »
relLangURL
Returns a relative URL with a language prefix, if any.
Read More »
relURL
Returns a relative URL.
Read More »
replaceRE
Returns a string, replacing all occurrences of a regular expression with a replacement pattern.
Read More »
safeHTMLAttr
Declares the provided string as a safe HTML attribute.
Read More »
strings.Contains
Reports whether a string contains a substring.
Read More »
strings.ContainsAny
Reports whether a string contains any character from a given string.
Read More »
strings.FirstUpper
Capitalizes the first character of a given string.
Read More »
time.ParseDuration
Parses a given duration string into a
time.Duration
structure.
Read More »