From b80f0df305d31048873f92287a1172d04f1635cf Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 27 Feb 2018 06:40:19 +0000 Subject: [PATCH] Use post excerpt from front matter --- source/_layouts/post.html.twig | 4 ++++ source/blog.html | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/_layouts/post.html.twig b/source/_layouts/post.html.twig index 4e311670..6c6439f8 100644 --- a/source/_layouts/post.html.twig +++ b/source/_layouts/post.html.twig @@ -24,6 +24,10 @@ {% include 'post/header' %} {% include 'post/intro-image' %} + {% if page.excerpt %} + {{ page.excerpt|markdown }} + {% endif %} + {% block content %}{% endblock %} {% include 'post/twitter-link' %} diff --git a/source/blog.html b/source/blog.html index 6d372305..816f8857 100644 --- a/source/blog.html +++ b/source/blog.html @@ -19,12 +19,10 @@ use: [posts] {% include 'post/intro-image' with { page: post } %} - {% if post.blocks.excerpt %} - {{ post.blocks.excerpt|raw }} - {% elseif '' in post.blocks.content %} - {{ post.blocks.content|split('')|first|raw }} + {% if post.excerpt %} + {{ post.excerpt|markdown }} {% else %} -

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

+ {{ post.blocks.content|split('\n\n')|first|raw }} {% endif %}

Read more →