Search code examples
textwebblogsjekyll

How can I get a post excerpt in Jekyll?


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 %}`?


Solution

  • 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