--- layout: default title: Blog generator: pagination pagination: max_per_page: 10 use: [posts] --- {% block content %} <h1>Blog</h1> <ul class="list-reset"> {% for post in page.pagination.items %} <li class="mb-12"> <h2 class="text-xl mb-1"> <a href="{{ post.url }}" class="no-underline hover:underline focus:underline text-black hover:text-grey-darker focus:text-grey-darker"> {{ post.title }} </a> </h2> <div> <p class="text-grey-dark mb-2">{{ post.date|date('j F Y') }}</p> </div> {% include 'post/intro-image' with { page: post } %} <div class="markdown mb-4"> {{ post.summary|markdown }} {% if post.blocks.excerpt is defined %} {{ post.blocks.excerpt|markdown }} {% else %} {{ post.blocks.content|markdown }} {% endif %} </div> </li> {% endfor %} </ul> {% if page.pagination.previous_page or page.pagination.next_page %} <ul class="list-reset flex"> {% if page.pagination.next_page %} <li class="w-1/2"> <a href="{{ site.url }}{{ page.pagination.next_page.url }}">← Older posts</a> </li> {% endif %} {% if page.pagination.previous_page %} <li class="text-right {{ page.pagination.next_page and page.pagination.previous_page ? 'w-1/2' : 'w-full' }}"> <a href="{{ site.url }}{{ page.pagination.previous_page.url }}">Newer posts →</a> </li> {% endif %} </ul> {% endif %} {% endblock %}