Skip to content
Permalink
Browse files
More control for post excerpts
Changed excerpt behaviour. Posts can have individually defined
excerpts. No more truncation after 50 words. “Read More” is only
displayed if there is more content.
  • Loading branch information
radikahl authored and radikahl committed Jul 9, 2016
1 parent facde32 commit 7beb5b95f996adb295ba910bd817340f07fecbad
Showing 1 changed file with 10 additions and 2 deletions.
@@ -22,8 +22,16 @@ <h3 class="post-subtitle">
</p>

<div class="post-entry">
{{ post.content | strip_html | xml_escape | truncatewords: 50 }}
<a href="{{ post.url | prepend: site.baseurl }}" class="post-read-more">[Read&nbsp;More]</a>
{{ post.excerpt }}
{% capture content_words %}
{{ post.content | number_of_words }}
{% endcapture %}
{% capture excerpt_words %}
{{ post.excerpt | number_of_words }}
{% endcapture %}
{% if excerpt_words != content_words %}
<p><a href="{{ post.url | prepend: site.baseurl }}" class="post-read-more">[Read&nbsp;More]</a></p>
{% endif %}
</div>

</article>

0 comments on commit 7beb5b9

Please sign in to comment.