I'm creating a new blog using Jekyll.
On the main page, there will be a list of my 10 most recent posts.
The entries on this list will include a title, the post date, and an excerpt, most likely the first paragraph.
I'm only familiar with using Jekyll for basic templates, so I can either put only a variable in the page, or include the entire post.
Is there a way to somehow avoid using post.content
in the paginator, and only include up to a certain point in the post, which I define (e.g. ``{% endexcerpt %}`?
Something like {{ post.content | strip_html | truncatewords: 50 }}
produces a more consistent excerpt. It gets the first 50 words and strips any formatting.
Sure, you can use {{ post.excerpt }}
in place of {{ post.content }}
.
You can also manually override the automatically generated excerpts if you don't like them.
Full documentation on how to do this here: http://jekyllrb.com/docs/posts/#post-excerpts
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