From 1b668a32237f6064e9e01984b54f8a93b58308d3 Mon Sep 17 00:00:00 2001
From: Luke Dodge
Date: Tue, 4 Oct 2016 21:12:20 -0500
Subject: [PATCH] Add check to only show readme link when there is additional
post content not shown on index page. Handles truncate words problems with
Chinese and Japanese characters by checking for a manual break using the site
excerpt separator. (#110)
---
_config.yml | 2 ++
index.html | 15 +++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/_config.yml b/_config.yml
index 8dc616f..534daac 100644
--- a/_config.yml
+++ b/_config.yml
@@ -81,6 +81,8 @@ share-links-active:
url-pretty: "MyWebsite.com" # eg. "deanattali.com/beautiful-jekyll"
# --- Misc --- #
+# Manually break the site excerpt
+excerpt_separator:
# Fill in your Disqus shortname (NOT the userid) if you want to support Disqus comments
#disqus: ""
diff --git a/index.html b/index.html
index 463143b..5f93984 100644
--- a/index.html
+++ b/index.html
@@ -22,8 +22,19 @@ subtitle: This is where I will tell my friends way too much about me
- {{ post.excerpt | strip_html | xml_escape | truncatewords: 50 }}
-
[Read More]
+ {% if post.content contains site.excerpt_separator %}
+ {{ post.excerpt | strip_html | xml_escape }}
+
[Read More]
+ {% else %}
+ {% assign cleaned_content = post.content | strip_html | xml_escape %}
+ {% assign truncated_content = cleaned_content | truncatewords: 50 %}
+ {% if truncated_content == cleaned_content %}
+ {{ cleaned_content }}
+ {% else %}
+ {{ truncated_content }}
+
[Read More]
+ {% endif%}
+ {% endif %}
{% if post.tags.size > 0 %}