| 1 |
--- |
| 2 |
title: ByLinkTitle |
| 3 |
description: Returns the given page collection sorted by link title in ascending order, falling back to title if link title is not defined. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: page.Pages |
| 9 |
signatures: [PAGES.ByLinkTitle] |
| 10 |
--- |
| 11 |
|
| 12 |
```go-html-template |
| 13 |
{{ range .Pages.ByLinkTitle }} |
| 14 |
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2> |
| 15 |
{{ end }} |
| 16 |
``` |
| 17 |
|
| 18 |
To sort in descending order: |
| 19 |
|
| 20 |
```go-html-template |
| 21 |
{{ range .Pages.ByLinkTitle.Reverse }} |
| 22 |
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2> |
| 23 |
{{ end }} |
| 24 |
``` |