-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
summaryLength doesn't count headers, lists, or code blocks as words #11863
Comments
TLDR: Use a manual summary in this case. Automatic summaryWhen rendering an automatic summary, Hugo uses the Example 1
content
summary (data type = template.HTML)
Example 2
content
summary (data type = template.HTML) The quick brown fox jumps over the lazy dog. Consequat dolor cupidatat adipisicing consequat ut id proident amet id excepteur deserunt. Manual summaryTo truncate at a specific point in the content, use a manual summary ( content
summary (data type = template.HTML) <p>The quick</p> Summary in front matterOr you can specify the summary in front matter (
summary (data type = template.HTML) <p>The quick brown fox</p> OtherThis comment describes some of the other differences between the 3 summary types. OpinionIn my view there are 3 different related things:
For this reason I usually define both I am closing this because the existing behavior is expected. |
Manual and front matter summaries are a reasonable workaround that I've already switched to using. However it seems quite reasonable to say that It might be reasonable to treat this as dupe of #1503, since that may or may not end up addressing this. |
We will handle this in documentation, see gohugoio/hugoDocs#2388. The |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What version of Hugo are you using (
hugo version
)?0.122.0
Does this issue reproduce with the latest release?
Yes
Given a config with
summaryLength = 2
and a post with the following contentThe summary will be much longer than 2 words
Inserting a second
asd
somewhere will truncate the summary sooner.From this, I gather that headers and lists are not counted as words and can lead to arbitrarily long summaries. I think they should both count toward the word limit.
Interestingly, lists sometimes count towards the word limit.
In this case
TODO: 1
has been counted as a word and the secondasd
was not included in the summary.This also affects code blocks. Entire code blocks of arbitrary size are included in summaries without affecting the world limit.
The text was updated successfully, but these errors were encountered: