Skip to content

Instantly share code, notes, and snippets.

@keithgreer
Last active December 23, 2021 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keithgreer/ad5b893a89679a949dcc4e419694ceb3 to your computer and use it in GitHub Desktop.
Save keithgreer/ad5b893a89679a949dcc4e419694ceb3 to your computer and use it in GitHub Desktop.
Jekyll - Generate latest posts in Liquid https://keithgreer.dev/jekyll-posts-loop-liquid-template
{% for post in site.posts limit:1 %}
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
{{ post.content | strip_html | truncatehtml | truncatewords: 40 }}
{% endfor %}
{% for post in site.posts offset:1 limit:4 %}
<h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
{{ post.content | strip_html | truncatehtml | truncatewords: 20 }}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment