mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Merge commit '8b9803425e63e1b1801f8d5d676e96368d706722'
This commit is contained in:
@@ -34,7 +34,7 @@ To reverse the sort order:
|
||||
To inspect the data structure:
|
||||
|
||||
```go-html-template
|
||||
<pre>{{ jsonify (dict "indent" " ") $taxonomyObject.Alphabetical }}</pre>
|
||||
<pre>{{ debug.Dump $taxonomyObject.Alphabetical }}</pre>
|
||||
```
|
||||
|
||||
{{% include "methods/taxonomy/_common/ordered-taxonomy-element-methods.md" %}}
|
||||
|
@@ -34,7 +34,7 @@ To reverse the sort order:
|
||||
To inspect the data structure:
|
||||
|
||||
```go-html-template
|
||||
<pre>{{ jsonify (dict "indent" " ") $taxonomyObject.ByCount }}</pre>
|
||||
<pre>{{ debug.Dump $taxonomyObject.ByCount }}</pre>
|
||||
```
|
||||
|
||||
{{% include "methods/taxonomy/_common/ordered-taxonomy-element-methods.md" %}}
|
||||
|
@@ -43,7 +43,7 @@ You could also use the [`index`] function, but the syntax is more verbose:
|
||||
To inspect the data structure:
|
||||
|
||||
```go-html-template
|
||||
<pre>{{ jsonify (dict "indent" " ") $weightedPages }}</pre>
|
||||
<pre>{{ debug.Dump $weightedPages }}</pre>
|
||||
```
|
||||
|
||||
## Example
|
||||
@@ -66,7 +66,7 @@ Hugo renders:
|
||||
```
|
||||
|
||||
[chaining]: /getting-started/glossary/#chain
|
||||
[`index`]: /functions/collections/indexfunction
|
||||
[`index`]: /functions/collections/indexfunction/
|
||||
[identifier]: /getting-started/glossary/#identifier
|
||||
[term]: /getting-started/glossary/#term
|
||||
[weighted pages]: /getting-started/glossary/#weighted-page
|
||||
|
26
docs/content/en/methods/taxonomy/Page.md
Normal file
26
docs/content/en/methods/taxonomy/Page.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: Page
|
||||
description: Returns the taxonomy page or nil if the taxonomy has no terms.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: page.Page
|
||||
signatures: [TAXONOMY.Page]
|
||||
---
|
||||
|
||||
{{< new-in 0.125.0 >}}
|
||||
|
||||
This `TAXONOMY` method returns nil if the taxonomy has no terms, so you must code defensively:
|
||||
|
||||
```go-html-template
|
||||
{{ with .Site.Taxonomies.tags.Page }}
|
||||
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
This is rendered to:
|
||||
|
||||
```html
|
||||
<a href="/tags/">Tags</a>
|
||||
```
|
@@ -7,7 +7,7 @@ cascade:
|
||||
---
|
||||
|
||||
<!--
|
||||
Files within this headless branch bundle are markdown snippets. Each file must contain front matter delimiters, though front matter fields are not required.
|
||||
Files within this headless branch bundle are Markdown snippets. Each file must contain front matter delimiters, though front matter fields are not required.
|
||||
|
||||
Include the rendered content using the "include" shortcode.
|
||||
-->
|
||||
|
@@ -41,7 +41,7 @@ To capture the "genres" taxonomy object when rendering its page with a taxonomy
|
||||
To inspect the data structure:
|
||||
|
||||
```go-html-template
|
||||
<pre>{{ jsonify (dict "indent" " ") $taxonomyObject }}</pre>
|
||||
<pre>{{ debug.Dump $taxonomyObject }}</pre>
|
||||
```
|
||||
|
||||
Although the [`Alphabetical`] and [`ByCount`] methods provide a better data structure for ranging through the taxonomy, you can render the weighted pages by term directly from the `Taxonomy` object:
|
||||
@@ -60,9 +60,9 @@ Although the [`Alphabetical`] and [`ByCount`] methods provide a better data stru
|
||||
In the example above, the first anchor element is a link to the term page.
|
||||
|
||||
|
||||
[`Alphabetical`]: /methods/taxonomy/alphabetical
|
||||
[`ByCount`]: /methods/taxonomy/bycount
|
||||
[`Alphabetical`]: /methods/taxonomy/alphabetical/
|
||||
[`ByCount`]: /methods/taxonomy/bycount/
|
||||
|
||||
[`data`]: /methods/page/data
|
||||
[`data`]: /methods/page/data/
|
||||
[`terms`]: /methods/page/data/#in-a-taxonomy-template
|
||||
[`taxonomies`]: /methods/site/taxonomies
|
||||
[`taxonomies`]: /methods/site/taxonomies/
|
||||
|
@@ -21,5 +21,5 @@ Term
|
||||
WeightedPages
|
||||
: (`page.WeightedPages`) Returns a slice of weighted pages to which the term is assigned, sorted by [taxonomic weight]. The `Pages` method above is more flexible, allowing you to sort and group.
|
||||
|
||||
[methods]: /methods/pages
|
||||
[methods]: /methods/pages/
|
||||
[taxonomic weight]: /getting-started/glossary/#taxonomic-weight
|
||||
|
Reference in New Issue
Block a user