Currently, I include excerpts like this:
{{ post.excerpt | strip_html }}
But this seems to give only the first paragraph. But I would like to get a fixed number of words.
Or better: I would like to define a maximum number of characters and get so many words that
Is there a way to do this with Jekyll (1.3.1)?
edit: <!-- more -->
is not an answer! I think excerpting should work automatically and my posts should only contain markup that is absolutely necessary.
The following gives a 75 words automatic excerpt:
{{ post.content | strip_html | truncatewords:75 }}
Actually <!-- more -->
is the answer. At least, it works well now.
Add this line to your _config.yml:
excerpt_separator: "<!-- more -->"
Then add this to each post in your site:
<!-- more -->
Hope it will help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With