Skip to content

Instantly share code, notes, and snippets.

@budparr
Created November 27, 2013 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save budparr/7670277 to your computer and use it in GitHub Desktop.
Save budparr/7670277 to your computer and use it in GitHub Desktop.
copy of realjenius bit of non-plugin liquid code to generate a series of posts https://github.com/realjenius/site-samples/blob/master/2012-11-03-jekyll-series-list/series.html
{% assign count = '0' %}
{% assign idx = '0' %}
{% for post in site.posts reversed %}
{% if post.series == page.series %}
{% capture count %}{{ count | plus: '1' }}{% endcapture %}
{% if post.url == page.url %}
{% capture idx %}{{count}}{% endcapture %}
{% endif %}
{% endif %}
{% endfor %}
<div class="seriesNote">
<p>This article is <strong>Part {{ idx }}</strong> in a <strong>{{ count }}-Part</strong> Series: "{{ page.series}}"</p>
<ul>
{% assign count = '0' %}
{% for post in site.posts reversed %}
{% if post.series == page.series %}
{% capture count %}{{ count | plus: '1' }}{% endcapture %}
<li>Part {{ count }} -
{% if page.url == post.url %}
This Article
{% else %}
<a href="{{post.url}}">{{post.title}}</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment