kaplan kaplan - 2 months ago 8
Markdown Question

How do I use markdownify in Jekyll to show an excerpt on the index

I'm looking to show a short excerpt of text from a longer post or page on the index page. I was going to use a custom variable in the Front Matter and grab that, but then I saw the filter for

.excerpt


I see in the Jekyll docs there's something called
{{ page.excerpt | markdownify }}
How would I markup the markdown on a page or post in order to use that filter?

edit: Or does markdownify take the entire .md document?

Answer

In the post markdown files you need to first set your excerpt, here is an example from one of my posts

layout: post
title: A developers toolkit
date: Friday 14 December, 2012
excerpt: What text editor to use? Sass or plain old CSS? What on earth is Compass? Command    line? I'm not touching that. Sound like you? Welcome, I was once like you and this is the guide I wish someone had given me.

Then on the index page call the tag

{{ post.excerpt }}

This should then output what you have wrote in the markdown file. Nice and simple and why I love Jekyll.