Skip to content

Commit

Permalink
More control for post excerpts
Browse files Browse the repository at this point in the history
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 7beb5b9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 7beb5b9

Please sign in to comment.