Help:Shortcode Relref
Use relative permalinks for your links.
Shortcode | |
Description | |
---|---|
Type | Built-in |
Nested? | false |
Shortcode | relref |
Short Description Create a relative permalink to a resource. HTML figure. | |
Hugo Documentation | Shortcodes |
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:
Parameter | Description |
---|---|
[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
/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
In Markdown Links
[shortcodes]({{< relref "shortcodes" >}})
[Image Conventions]({{< relrel "shortcodes#image-conventions" >}})
In HTML Links
<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.
Categories | Contributors |
---|---|
Help, Contribute and Shortcode | Michael Sasser |