From 86d2b16dae2535385e75aead10059d1d70a74341 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Fri, 26 May 2017 16:20:15 +0200 Subject: [PATCH] - Add "read more" - Truncate based on based on / or word limit as fallback --- _includes/news.html | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/_includes/news.html b/_includes/news.html index c7b4a644..4a5a607a 100644 --- a/_includes/news.html +++ b/_includes/news.html @@ -11,7 +11,15 @@
Published on {{ post_1.date | date: "%Y-%m-%d"}} by {{ post_1.author }}
Published on {{ post_2.date | date: "%Y-%m-%d"}} by {{ post_2.author }}
- {{ post_2.content | truncatewords: site.post-preview-words | markdownify }} + {% if post_2.content contains '' %} + {{ post_2.content | split:'' | first | markdownify}} + read more + {% else %} + {{ post_2.content | truncatewords: site.post-preview-words, "" | markdownify }} + {% if (post_2.content | number_of_words) > site.post-preview-words %} + read more + {% endif %} + {% endif %}Published on {{ post_3.date | date: "%Y-%m-%d"}} by {{ post_3.author }}
- {{ post_3.content | truncatewords: site.post-preview-words | markdownify }} + {% if post_3.content contains '' %} + {{ post_3.content | split:'' | first | markdownify}} + read more + {% else %} + {{ post_3.content | truncatewords: site.post-preview-words, "" | markdownify }} + {% if (post_3.content | number_of_words) > site.post-preview-words %} + read more + {% endif %} + {% endif %}