content: Add warning about automatic summaries

See https://github.com/gohugoio/hugo/issues/14044
This commit is contained in:
Sardorbek Imomaliev
2025-10-13 21:00:41 +01:00
committed by GitHub
parent 2065fadded
commit ca21f5fbd3
2 changed files with 9 additions and 0 deletions
@@ -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:
@@ -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
View File
@@ -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
@@ -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