Help:Shortcode Relref

Use relative permalinks for your links.

Relref
Shortcode
Description
TypeBuilt-in
Nested?false
Shortcoderelref
Short Description
Create a relative permalink to a resource. HTML figure.
Hugo DocumentationShortcodes

relref is a built-in shortcode defined by Hugo using the ref function .

The relref shortcode can be used to create permalinks with an relative path, to a resource using either an absolute or relative path.

For more information, check Hugo – Links and Cross References →

Parameters

The relref shortcode has the following parameters:

ParameterDescription
[0]The path to a page, with or without a file extension, with or without an anchor. A path without a leading / is first resolved relative to the given context, then to the remainder of the site

Examples

From an absolute path:

{{< relref "/wiki/Help:Shortcode_Ref" >}}<br />
{{< relref "/wiki/Help:Shortcode_Ref.md" >}}<br />
{{< ref "/wiki/Help:Shortcode_Ref.md#Examples" >}}
Rendered
/wiki/Help:Shortcode_Ref/
/wiki/Help:Shortcode_Ref/
/wiki/Help:Shortcode_Ref/#Examples

From a relative path:

{{< relref "Help:Shortcode_Ref" >}}<br />
{{< relref "Help:Shortcode_Ref.md" >}}<br />
{{< relref "Help:Shortcode_Ref.md#Examples" >}}
Rendered


#Examples
[shortcodes]({{< relref "shortcodes" >}}) 
[Image Conventions]({{< relrel "shortcodes#image-conventions" >}})
<a href="{{< relref "shortcodes" >}}"Shortcodes</a>
<a href="{{< relref "shortcodes#image-conventions" >}}">Image Conventions</a>

HTML links are normally only used in HTML documents or nested shortcodes, like the following warning, where you can’t use Markdown.

{{< alert >}}
A link inside an alert: <a href="{{< relref "wiki/Help:Workflow.md" >}}">Workflow</a>.
{{< /alert >}}
Rendered
A link inside an alert: Workflow.
Top