mirror of
https://github.com/metagov/govarch-website.git
synced 2025-06-18 17:14:15 +00:00
add option to show post excerpts on posts with a title
This commit is contained in:
13
_includes/post-excerpt.html
Normal file
13
_includes/post-excerpt.html
Normal 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>
|
@ -1,24 +1,17 @@
|
||||
{% capture excerpt %}
|
||||
{{ post.excerpt | replace: "<p>", "" | replace: "</p>", "" }}
|
||||
{% endcapture %}
|
||||
|
||||
{% assign excerpt_length = excerpt | size %}
|
||||
|
||||
<li>
|
||||
<a href="{{ post.url | absolute_url }}" class="post-link">
|
||||
{% unless post.title == "" %}
|
||||
<span class="post-title">
|
||||
{{ post.title }}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="post-title">
|
||||
{% if excerpt_length > 140 %}
|
||||
{{ excerpt | truncatewords: 12, '…' }}
|
||||
{% else %}
|
||||
{{ excerpt }}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endunless %}
|
||||
<div class="post-link__heading">
|
||||
{% unless post.title == "" %}
|
||||
<h1 class="post-link__title">
|
||||
{{ post.title }}
|
||||
</h1>
|
||||
{% else %}
|
||||
{% include post-excerpt.html %}
|
||||
{% endunless %}
|
||||
{% if post.title != "" and site.show_excerpts == true %}
|
||||
{% include post-excerpt.html %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<span class="post-date">
|
||||
{{ post.date | date: "%b %-d, '%y" }}
|
||||
</span>
|
||||
|
Reference in New Issue
Block a user