From 1a41e952072707c76aa6ae84b67901cab05b96de Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 27 Feb 2018 21:18:35 +0000 Subject: [PATCH] Update post template for excerpts --- source/_layouts/post.html.twig | 9 ++++----- source/blog.html | 8 +++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/_layouts/post.html.twig b/source/_layouts/post.html.twig index 6c6439f8..71228e57 100644 --- a/source/_layouts/post.html.twig +++ b/source/_layouts/post.html.twig @@ -24,11 +24,10 @@ {% include 'post/header' %} {% include 'post/intro-image' %} - {% if page.excerpt %} - {{ page.excerpt|markdown }} - {% endif %} - - {% block content %}{% endblock %} +
+ {% block excerpt %}{% endblock %} + {% block content %}{% endblock %} +
{% include 'post/twitter-link' %} {% include 'post/tags' %} diff --git a/source/blog.html b/source/blog.html index 816f8857..6d372305 100644 --- a/source/blog.html +++ b/source/blog.html @@ -19,10 +19,12 @@ use: [posts] {% include 'post/intro-image' with { page: post } %} - {% if post.excerpt %} - {{ post.excerpt|markdown }} + {% if post.blocks.excerpt %} + {{ post.blocks.excerpt|raw }} + {% elseif '' in post.blocks.content %} + {{ post.blocks.content|split('')|first|raw }} {% else %} - {{ post.blocks.content|split('\n\n')|first|raw }} +

{{ post.blocks.content|raw|striptags|split(' ')|slice(0,50)|join(' ')|replace({ 'h2': 'h3' }) }} …

{% endif %}

Read more →