Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll max excerpt length

Tags:

jekyll

liquid

I am trying to get a an excerpt of my posts to serve as the description meta tag on my page. Is there any way to limit the excerpt characters to 156?

Here is my current code:

{{ page.excerpt | strip_html | strip_newlines}}
like image 634
Ethan Avatar asked Dec 24 '22 13:12

Ethan


1 Answers

Use the truncate filter:

{{ page.excerpt | strip_html | strip_newlines | truncate: 156 }}  
like image 52
marcanuy Avatar answered Mar 30 '23 00:03

marcanuy