mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
``` git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash ``` Closes #11925
1.1 KiB
1.1 KiB
title, description, categories, keywords, action
| title | description | categories | keywords | action | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Truncated | Reports whether the content length exceeds the summary length. |
|
There are three ways to define the content summary:
- Let Hugo create the summary based on the first 70 words. You can change the number of words by setting the
summaryLengthin your site configuration. - Manually split the content with a
<--more-->tag in markdown. Everything before the tag is included in the summary. - Create a
summaryfield in front matter.
{{% note %}}
The Truncated method returns false if you define the summary in front matter.
{{% /note %}}
The Truncated method returns true if the content length exceeds the summary length. This is useful for 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 }}