Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (33 sloc) 1.26 KB
title description godocref date publishdate lastmod categories menu keywords signature workson hugoversion relatedfuncs deprecated aliases
relref
Looks up a content page by relative path.
2017-02-01
2017-02-01
2019-12-28
functions
docs
parent
functions
cross references
anchors
relref . CONTENT
ref
false

ref and relref look up a content page by logical name (ref) or relative path (relref) to return the permalink:

{{ relref . "about.md" }}

{{% note "Usage Note" %}} relref looks up Hugo "Regular Pages" only. It can't be used for the homepage, section pages, etc. {{% /note %}}

It is also possible to pass additional arguments to link to another language or an alternative output format. Therefore, pass a map of arguments instead of just the path.

{{ relref . (dict "path" "about.md" "lang" "ja" "outputFormat" "rss") }}

These functions are used in two of Hugo's built-in shortcodes. You can see basic usage examples of both ref and relref in the shortcode documentation.

For an extensive explanation of how to leverage ref and relref for content management, see Cross References.

You can’t perform that action at this time.