Debian Codegraph @

docs/content/en/methods/page/LinkTitle.md

raw
1 ---
2 title: LinkTitle
3 description: Returns the link title of the given page.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: string
9 signatures: [PAGE.LinkTitle]
10 ---
11
12 The `LinkTitle` method returns the `linkTitle` field as defined in front matter, falling back to the value returned by the [`Title`][] method.
13
14 {{< code-toggle file=content/articles/healthy-desserts.md fm=true >}}
15 title = 'Seventeen delightful recipes for healthy desserts'
16 linkTitle = 'Dessert recipes'
17 {{< /code-toggle >}}
18
19 ```go-html-template
20 {{ .LinkTitle }} → Dessert recipes
21 ```
22
23 As demonstrated above, defining a link title in front matter is advantageous when the page title is long. Use it when generating anchor elements in your templates:
24
25 ```go-html-template
26 <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
27 ```
28
29 [`Title`]: /methods/page/title/