Fix show/hide of Read Me link on index page (#111)

This commit is contained in:
Luke Dodge 2016-10-07 04:56:48 -05:00 committed by Dean Attali
parent dfb1c61917
commit f4d139d2d0
2 changed files with 9 additions and 8 deletions

View File

@ -90,6 +90,10 @@ url-pretty: "MyWebsite.com" # eg. "deanattali.com/beautiful-jekyll"
# Facebook App ID # Facebook App ID
# fb_app_id: "" # fb_app_id: ""
# Excerpt Word Length
# Truncates the excerpt to the specified number of words on the index page
excerpt_length: 50
# --- Don't need to touch anything below here (but you can if you want) --- # # --- Don't need to touch anything below here (but you can if you want) --- #
# Output options (more information on Jekyll's site) # Output options (more information on Jekyll's site)

View File

@ -22,19 +22,16 @@ subtitle: This is where I will tell my friends way too much about me
</p> </p>
<div class="post-entry"> <div class="post-entry">
{% assign cleaned_content = post.excerpt | strip_html | xml_escape %} {{ post.excerpt | strip_html | xml_escape | truncatewords: site.excerpt_length }}
{% assign truncated_content = cleaned_content | truncatewords: 50 %} {% assign excerpt_word_count = post.excerpt | number_of_words %}
{% if truncated_content == cleaned_content %} {% if post.content != post.excerpt or excerpt_word_count > site.excerpt_length %}
{{ cleaned_content }}
{% else %}
{{ truncated_content }}
<a href="{{ post.url | prepend: site.baseurl }}" class="post-read-more">[Read&nbsp;More]</a> <a href="{{ post.url | prepend: site.baseurl }}" class="post-read-more">[Read&nbsp;More]</a>
{% endif%} {% endif %}
</div> </div>
{% if post.tags.size > 0 %} {% if post.tags.size > 0 %}
<div class="blog-tags"> <div class="blog-tags">
Tags: Tags:
{% if site.link-tags %} {% if site.link-tags %}
{% for tag in post.tags %} {% for tag in post.tags %}
<a href="{{ site.baseurl }}/tag/{{ tag }}">{{ tag }}</a> <a href="{{ site.baseurl }}/tag/{{ tag }}">{{ tag }}</a>