--- layout: default title: Blog generator: pagination pagination: max_per_page: 10 use: [posts] --- {% block content %} <h1>Blog</h1> <ul class="list pa0 ma0"> {% for post in page.pagination.items %} <li class="cf mb2 pb4 bb b--light-silver"> {{ include('post/header', { page: post, title_tag: 'h2' }) }} {% include 'post/intro-image' with { page: post } %} {% if post.blocks.excerpt %} {{ post.blocks.excerpt|raw }} {% else %} <p>{{ post.blocks.content|raw|striptags|split(' ')|slice(0,50)|join(' ')|replace({ 'h2':'h3' }) }} …</p> {% endif %} <a href="{{ post.url }}">Read more →</a> </li> {% endfor %} </ul> {% if page.pagination.previous_page or page.pagination.next_page %} <ul class="pager"> {% if page.pagination.previous_page %} <li class="next"><a href="{{ site.url }}{{ page.pagination.previous_page.url }}">Newer →</a></li> {% endif %} {% if page.pagination.next_page %} <li class="previous"><a href="{{ site.url }}{{ page.pagination.next_page.url }}">← Older</a></li> {% endif %} </ul> {% endif %} {% endblock %}