少于1分钟
将以下英文翻译为中文:
https://gohugo.io/functions/relref/
Returns the relative permalink to a page.
relref . PAGE
This function takes two parameters:
.
)/
is first resolved relative to the given context, then to the remainder of the site.
|
|
The permalink returned is relative to the protocol+host portion of the baseURL specified in the site configuration. For example:
Code | baseURL | Permalink |
---|---|---|
{{ relref . "/about" }} | http://example.org/ | /about/ |
{{ relref . "/about" }} | http://example.org/x/ | /x/about/ |
To return the relative permalink to another language version of a page:
|
|
To return the relative permalink to another Output Format of a page:
|
|
Hugo emits an error or warning if the page cannot be uniquely resolved. The error behavior is configurable; see Ref and RelRef Configuration.
This function is used by Hugo’s built-in relref
shortcode. For a detailed explanation of how to leverage this shortcode for content management, see Links and Cross References.