hugo/content/en/methods/page/GetTerms.md
Bjørn Erik Pedersen 9b0050e9aa Squashed 'docs/' content from commit 5c085a37b
git-subtree-dir: docs
git-subtree-split: 5c085a37b297bf12f59efeaae591418ec025c10d
2024-01-27 10:48:33 +01:00

41 lines
912 B
Markdown

---
title: GetTerms
description: Returns a collection of term pages for terms defined on the given page in the given taxonomy, ordered according to the sequence in which they appear in front matter.
categories: []
keywords: []
action:
related: []
returnType: page.Pages
signatures: [PAGE.GetTerms TAXONOMY]
---
Given this front matter:
{{< code-toggle file=content/books/les-miserables.md fm=true >}}
title = 'Les Misérables'
tags = ['historical','classic','fiction']
{{< /code-toggle >}}
This template code:
```go-html-template
{{ with .GetTerms "tags" }}
<p>Tags</p>
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ end }}
```
Is rendered to:
```html
<p>Tags</p>
<ul>
<li><a href="/tags/historical/">historical</a></li>
<li><a href="/tags/classic/">classic</a></li>
<li><a href="/tags/fiction/">fiction</a></li>
</ul>
```