| 1 |
--- |
| 2 |
title: GetTerms |
| 3 |
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. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: page.Pages |
| 9 |
signatures: [PAGE.GetTerms TAXONOMY] |
| 10 |
--- |
| 11 |
|
| 12 |
Given this front matter: |
| 13 |
|
| 14 |
{{< code-toggle file=content/books/les-miserables.md fm=true >}} |
| 15 |
title = 'Les Misérables' |
| 16 |
tags = ['historical','classic','fiction'] |
| 17 |
{{< /code-toggle >}} |
| 18 |
|
| 19 |
This template code: |
| 20 |
|
| 21 |
```go-html-template |
| 22 |
{{ with .GetTerms "tags" }} |
| 23 |
<p>Tags</p> |
| 24 |
<ul> |
| 25 |
{{ range . }} |
| 26 |
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> |
| 27 |
{{ end }} |
| 28 |
</ul> |
| 29 |
{{ end }} |
| 30 |
``` |
| 31 |
|
| 32 |
Is rendered to: |
| 33 |
|
| 34 |
```html |
| 35 |
<p>Tags</p> |
| 36 |
<ul> |
| 37 |
<li><a href="/tags/historical/">historical</a></li> |
| 38 |
<li><a href="/tags/classic/">classic</a></li> |
| 39 |
<li><a href="/tags/fiction/">fiction</a></li> |
| 40 |
</ul> |
| 41 |
``` |