[typhoon] line breaks in blog post previews
Closed this issue · 1 comments
The preview texts in the blog overview page (Twig origin: post-item.html.twig) do not contain line breaks, although there are some in the original text.
I've been searching for hours, but can't find the right setting for change this.
Many thanks for your support.
Typhoon v2.4.6
The preview text that is shown in the blog listing page with the cards that are rendered via the post-item.html.twig
is actually stripping the HTML tags so that the cards are not congested with rendered HTML like titles, paragraphs etc.
You can change this behavior by modifying your post-item.html.twig
and changing the second paramater of the page.summary()
method to false
rather than true
. I've broken it out into separate variables to make things a bit simpler:
{% set page_summary = page.summary(null, false) %}
{% set summary_length = 170 %}
{% set summary_size = bg_image ? (page_summary|length < summary_length ? page_summary : page.summary(summary_length, false)) : page_summary %}
You might want to play with that 170
value until things look right to you.
The last line there uses an inline logic that converts to:
if there's a bg_image, check if page_summary length with default site.summary length is smaller than defined summary_length (170), if so, just use page_summary, if its greater than that, get the page summary with length of 170. If no bg_image, simply use the page_summary as is.