A new Siteleaf is here, upgrade to v2 →




See Content for available variables.

Posts belong to a page. A post could be a blog post, a portfolio item, an event, or anything that makes sense ordered chronologically. Posts are very similar to a Page, however they can have taxonomies and are ordered chronologically by default.

Count the number of posts:

This page has {{posts | size}} posts.

Loop through the first 20 posts on the current page:

{% for post in posts limit:20 %}
  <header><a href="{{post.url}}">{{post.title}}</a></header>
  <footer>Posted on {{post.date | date: "%b %d, %Y"}} by {{post.author.fullname}}</footer>
{% endfor %}

Loop through all posts where the author is Sawyer:

{% assign my_posts = site.posts | where:"author","Sawyer" %}

  {% for post in my_posts %}
    <li><a href="{{post.url}}">{{post.title}}</a></li>
  {% endfor %}