Truncated
Reports whether the content length exceeds the summary length.
Syntax
PAGE.Truncated
Returns
bool
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.
The Truncated method returns true if the content length exceeds the summary length. This is useful for conditionally rendering a “read more” link:
{{ range .Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">Read more...</a>
{{ end }}
{{ end }}The Truncated method returns false if you define the summary in front matter.
Last updated:
April 10, 2025
:
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65' (283e97783)
Improve this page