Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions content/en/content-management/summaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ For example, with a `summaryLength` of 7, the automatic summary will be:
<p>This is the second paragraph.</p>
```

> [!warning]
> Automatic `.Summary` may cut block tags (e.g., `blockquote`) in the middle when `summaryLength` is reached, causing the browser to recover the end tag (the end tag will be inserted before the parent's end tag), resulting in unexpected rendering behavior. To avoid this, wrap `.Summary` in a `<div>`; alternatively, wrap it together with the heading tag using `<section>`. You can avoid this entirely by using a manual summary. See issue [#14044] for details.
## Comparison

Each summary type has different characteristics:
Expand Down Expand Up @@ -121,3 +124,5 @@ Instead of calling the `Summary` method on a `Page` object, use the [`strings.Tr
</div>
{{ end }}
```

[#14044]: https://github.com/gohugoio/hugo/issues/14044
4 changes: 4 additions & 0 deletions content/en/methods/page/Summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ To list the pages in a section with a summary beneath each link:
{{ end }}
```

> [!warning]
> Automatic `.Summary` may cut block tags (e.g., `blockquote`) in the middle, causing the browser to recover the end tag. See [automatic summary] for details and for ways to avoid this.
Depending on content length and how you define the summary, the summary may be equivalent to the content itself. To determine whether the content length exceeds the summary length, use the [`Truncated`] method on a `Page` object. This is useful for conditionally rendering a “read more” link:

```go-html-template
Expand All @@ -42,3 +45,4 @@ Depending on content length and how you define the summary, the summary may be e
[`Truncated`]: /methods/page/truncated
[summary]: /content-management/summaries/
[automatic summary]: /content-management/summaries/#automatic-summary