Truncate the description value to 280 chars

Currently the value of the `description`, `og: description`
and `twitter: description` tags includes the whole text of the post.

Which means that, on post pages, the text of the post is included *four*
times in the HTML document – adding to the page weight needlessly.

This commit ensures the description string is truncated to a sane value.
This commit is contained in:
Pierre de La Morinerie 2023-06-30 14:32:52 +02:00
parent db0e639259
commit 160505dcd0
1 changed files with 2 additions and 1 deletions

View File

@ -89,7 +89,8 @@ module Jekyll
def description
@description ||= begin
format_string(page["description"] || page["excerpt"]) || site_description
value = format_string(page["description"] || page["excerpt"]) || site_description
filters.truncate(value, 280)
end
end