mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-17 09:24:43 -04:00
Merge branch 'master' of github.com:gohugoio/hugoDocs
This commit is contained in:
commit
94ebe50ffa
@ -11,7 +11,7 @@ menu:
|
|||||||
docs:
|
docs:
|
||||||
parent: "functions"
|
parent: "functions"
|
||||||
keywords: [cross references, anchors]
|
keywords: [cross references, anchors]
|
||||||
signature: ["ref CONTENT"]
|
signature: ["ref . CONTENT"]
|
||||||
workson: []
|
workson: []
|
||||||
hugoversion:
|
hugoversion:
|
||||||
relatedfuncs: [relref]
|
relatedfuncs: [relref]
|
||||||
@ -19,12 +19,16 @@ deprecated: false
|
|||||||
aliases: []
|
aliases: []
|
||||||
---
|
---
|
||||||
|
|
||||||
`ref` and `relRef` look up a content page by relative path (`relref`) or logical name (`ref`) to return the permalink:
|
`ref` and `relref` look up a content page by logical name (`ref`) or relative path (`relref`) to return the permalink:
|
||||||
|
|
||||||
```
|
```
|
||||||
{{ ref "about.md" }}
|
{{ ref . "about.md" }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{{% note "Usage Note" %}}
|
||||||
|
`ref` looks up Hugo "Regular Pages" only. It can't be used for the homepage, section pages, etc.
|
||||||
|
{{% /note %}}
|
||||||
|
|
||||||
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](/content-management/shortcodes/#ref-and-relref).
|
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](/content-management/shortcodes/#ref-and-relref).
|
||||||
|
|
||||||
For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/).
|
For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/).
|
||||||
|
@ -11,20 +11,24 @@ menu:
|
|||||||
docs:
|
docs:
|
||||||
parent: "functions"
|
parent: "functions"
|
||||||
keywords: [cross references, anchors]
|
keywords: [cross references, anchors]
|
||||||
signature: ["relref CONTENT"]
|
signature: ["relref . CONTENT"]
|
||||||
workson: []
|
workson: []
|
||||||
hugoversion:
|
hugoversion:
|
||||||
relatedfuncs: [relref]
|
relatedfuncs: [ref]
|
||||||
deprecated: false
|
deprecated: false
|
||||||
aliases: []
|
aliases: []
|
||||||
---
|
---
|
||||||
|
|
||||||
`ref` and `relRef` look up a content page by relative path (`relref`) or logical name (`ref`) to return the permalink:
|
`ref` and `relref` look up a content page by logical name (`ref`) or relative path (`relref`) to return the permalink:
|
||||||
|
|
||||||
```
|
```
|
||||||
{{ relref "about.md" }}
|
{{ 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 %}}
|
||||||
|
|
||||||
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](/content-management/shortcodes/#ref-and-relref).
|
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](/content-management/shortcodes/#ref-and-relref).
|
||||||
|
|
||||||
For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/).
|
For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/).
|
||||||
|
@ -78,6 +78,9 @@ A Taxonomy is a `map[string]WeightedPages`.
|
|||||||
.ByCount
|
.ByCount
|
||||||
: Returns an OrderedTaxonomy (slice) ordered by number of entries.
|
: Returns an OrderedTaxonomy (slice) ordered by number of entries.
|
||||||
|
|
||||||
|
.Reverse
|
||||||
|
: Returns an OrderedTaxonomy (slice) in reverse order. Must be used with an OrderedTaxonomy.
|
||||||
|
|
||||||
### OrderedTaxonomy
|
### OrderedTaxonomy
|
||||||
|
|
||||||
Since Maps are unordered, an OrderedTaxonomy is a special structure that has a defined order.
|
Since Maps are unordered, an OrderedTaxonomy is a special structure that has a defined order.
|
||||||
@ -160,6 +163,17 @@ Taxonomies can be ordered by either alphabetical key or by the number of content
|
|||||||
</ul>
|
</ul>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Order by Least Popular Example
|
||||||
|
|
||||||
|
```
|
||||||
|
<ul>
|
||||||
|
{{ $data := .Data }}
|
||||||
|
{{ range $key, $value := .Data.Terms.ByCount.Reverse }}
|
||||||
|
<li><a href="{{ $.Site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
```
|
||||||
|
|
||||||
<!-- [See Also Taxonomy Lists](/templates/list/) -->
|
<!-- [See Also Taxonomy Lists](/templates/list/) -->
|
||||||
|
|
||||||
## Order Content within Taxonomies
|
## Order Content within Taxonomies
|
||||||
|
Loading…
x
Reference in New Issue
Block a user