blob: 8c25730697313582cdf2a1910115c9457b3f7d13 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
---
title: Truncated
description: Reports whether the content length exceeds the summary length.
categories: []
keywords: []
params:
functions_and_methods:
returnType: bool
signatures: [PAGE.Truncated]
---
You can define a [summary] manually, in front matter, or automatically. A manual summary takes precedence over a front matter summary, and a front matter summary takes precedence over an automatic summary.
[summary]: /content-management/summaries/
The `Truncated` method returns `true` if the content length exceeds the summary length. This is useful for conditionally rendering a "read more" link:
```go-html-template
{{ range .Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">Read more...</a>
{{ end }}
{{ end }}
```
> [!note]
> The `Truncated` method returns `false` if you define the summary in front matter.
|