add option to show post excerpts on posts with a title

This commit is contained in:
Pat Dryburgh
2018-08-12 14:04:49 -07:00
parent ed34b49645
commit 4d3d8d3e73
5 changed files with 46 additions and 31 deletions

View File

@ -0,0 +1,13 @@
{% capture excerpt %}
{{ post.excerpt | replace: "<p>", "" | replace: "</p>", "" }}
{% endcapture %}
{% assign excerpt_length = excerpt | size %}
<em class="post-link__excerpt">
{% if excerpt_length > 140 %}
{{ excerpt | truncatewords: 20, '…' }}
{% else %}
{{ excerpt }}
{% endif %}
</em>