Hi all. Does anyone know a code snippet for Dawn to reduce the number of lines of text on the ‘Blog Post’ card on the Home Page from 6 to 3. Thanks!
Hi @W_J_B
Go to your Online store > Themes > Edit code > open article-card.liquid, find this line of code
{{ article.excerpt | strip_html | truncatewords: 30 }}
Replace it with this code and save your file
{{ article.excerpt | strip_html | truncatewords: 15 }}
Thank you so much for your help! This worked with a bit of tweaking. The lines are:
{{ article.excerpt | strip_html | truncatewords: 30 }}
{%- else -%}
{{ article.content | strip_html | truncatewords: 30 }}
It worked when I changed ‘30’ at the end of both ‘article.content’ and ‘article.excerpt’. Changing ‘30’ to ‘17’ gave me three lines of text as I wanted.
Note that this code appeared twice in my article-card.liquid - only one of them made the change, and it effected the blog preview cards on both the Home Page and Blog Page.
Many thanks again
I actually realised that changing code at all is completely unnecessary. You can tell Shopify exactly what text to display in ‘Excerpt’ in the ‘Blog posts’ section in Sales Channel - Online Store.