Skip to content

Instantly share code, notes, and snippets.

Last active December 15, 2022 20:28
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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:

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

Which would produce:

Copy link

I have specified excerpt_separator: <!--more--> in the _config.yml file and in front matter, but it doesn't matter where I put it <!–more–>.
Upon request {{ post.excerpt }} I get all content 🙃

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