This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/source/blog.html
2017-12-10 23:43:40 +00:00

51 lines
1.6 KiB
HTML

---
layout: default
title: Blog
generator: pagination
pagination:
max_per_page: 10
use: [posts]
---
{% block content %}
<h1>Blog</h1>
<ul class="listing">
{% for post in page.pagination.items %}
<li class="listing-item">
{{ include('post/header', {
page: post,
title_tag: 'h2'
}) }}
{% include 'post/intro-image' with { page: post } %}
{% if post.blocks.excerpt %}
{{ post.blocks.excerpt|raw }}
{% elseif '<!-- split -->' in post.blocks.content %}
{{ post.blocks.content|split('<!-- split -->')|first|raw }}
{% else %}
<p>{{ post.blocks.content|raw|striptags|split(' ')|slice(0,50)|join(' ')|replace({ 'h2': 'h3' }) }} &hellip;</p>
{% endif %}
<p><a href="{{ post.url }}">Read more &rarr;</a></p>
</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="w-1/2 text-right">
<a href="{{ site.url }}{{ page.pagination.previous_page.url }}">Newer posts →</a>
</li>
{% endif %}
</ul>
{% endif %}
{% endblock %}