Help:Shortcode Ref
Use absolute permalinks for your links.
Shortcode | |
Description | |
---|---|
Type | Built-in |
Nested? | false |
Shortcode | ref |
Short Description Create an absolute permalink to a resource. HTML figure. | |
Hugo Documentation | Shortcodes |
ref
is a built-in shortcode defined by Hugo using the
ref function
.
The ref
shortcode can be used to create permalinks with an absolute path, to
a resource using either an absolute or relative path.
For more information, check Hugo – Links and Cross References →
Parameters
The ref
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:
{{< ref "/wiki/Help:Shortcode_Ref" >}}<br />
{{< ref "/wiki/Help:Shortcode_Ref.md" >}}<br />
{{< ref "/wiki/Help:Shortcode_Ref.md#Examples" >}}
Rendered
https://matrixpython.org/wiki/Help:Shortcode_Ref/
https://matrixpython.org/wiki/Help:Shortcode_Ref/
https://matrixpython.org/wiki/Help:Shortcode_Ref/#Examples
https://matrixpython.org/wiki/Help:Shortcode_Ref/
https://matrixpython.org/wiki/Help:Shortcode_Ref/#Examples
From a relative path:
{{< ref "Help:Shortcode_Ref" >}}<br />
{{< ref "Help:Shortcode_Ref.md" >}}<br />
{{< ref "Help:Shortcode_Ref.md#Examples" >}}
Rendered
#Examples
In Markdown Links
[shortcodes]({{< ref "shortcodes" >}})
[Image Conventions]({{< rel "shortcodes#image-conventions" >}})
In HTML Links
<a href="{{< ref "shortcodes" >}}"Shortcodes</a>
<a href="{{< ref "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="{{< ref "wiki/Help:Workflow.md" >}}">Workflow</a>.
{{< /alert >}}
Rendered
A link inside an alert: Workflow.
Categories | Contributors |
---|---|
Help, Contribute and Shortcode | Michael Sasser |