Skip to content

Instantly share code, notes, and snippets.

@rajibdpi
Forked from benbalter/excerpt.md
Created August 2, 2018 18:12
Show Gist options
  • Save rajibdpi/7f80d8ff79c337d45dca631ff262ab64 to your computer and use it in GitHub Desktop.
Save rajibdpi/7f80d8ff79c337d45dca631ff262ab64 to your computer and use it in GitHub Desktop.
Example of how to use Jekyll's `excerpt` tag.

If your post looked something like:

# Awesome Blog Post

Here is an example post to show how to use the new `excerpt` tag.

The excerpt tag provides a quick and easy way to tease a post by exposing only the first paragraph such as on a blog index page.

Then in your template, you could create an index file like this:

<ul>
{% for post in site.posts %}
  <li>
    <a href="{% post.permalink %}">{% post.title %}</a>
    <p>{{ post.excerpt }}</p>
  </li>
{% endfor %}
</ul>

Which would produce:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment