Skip to content

Commit

Permalink
conditional excerpt
Browse files Browse the repository at this point in the history
  • Loading branch information
geobrando committed Aug 28, 2015
1 parent 8f2bdb4 commit 6c00802
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 0 additions & 1 deletion _includes/post-excerpt.html
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
{{ item.excerpt }}
<p><a href="{{ site.baseurl }}{{ item.url }}">Read full post...</a></p>
18 changes: 11 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@

<!-- This loops through the paginated posts and events -->
{% for item in paginator.posts %}
{% if item.category == 'event' %}
<h2><a href='{{site.baseurl}}{{item.url}}'>{{item.title}}</a></h2>
<h2><a href='{{site.baseurl}}{{item.url}}'>{{item.title}}</a></h2>
{{ item.excerpt }}
{% capture content_words %}
{{ item.content | number_of_words }}
{% endcapture %}
{% capture excerpt_words %}
{{ item.excerpt | number_of_words }}
{% endcapture %}
{% if excerpt_words != content_words %}
{% include post-excerpt.html %}

{% endif %}
{% if item.category == 'event' %}
{% if item.rsvp %}
<div class='keyline-all round pad2 col12 clearfix'>
<div class='col8 pad0y'>
Expand All @@ -20,11 +28,7 @@ <h2><a href='{{site.baseurl}}{{item.url}}'>{{item.title}}</a></h2>
</div>
</div>
{% endif %}

{% else %}
<h2><a href='{{site.baseurl}}{{item.url}}'>{{item.title}}</a></h2>
{% include post-excerpt.html %}

<div class='pad1y keyline-top'>
<strong class='quiet small block space-bottom1'>Posted {{item.date | date:"%b %d %Y"}} {% if item.author %}by {{item.author}}{% endif %}</strong>
</div>
Expand Down

0 comments on commit 6c00802

Please sign in to comment.