Skip to content

Instantly share code, notes, and snippets.

@staxmanade
Last active August 29, 2015 13:59
Show Gist options
  • Save staxmanade/10601886 to your computer and use it in GitHub Desktop.
Save staxmanade/10601886 to your computer and use it in GitHub Desktop.
{% assign series = '' %}
{% assign thisPost = nil %}
{% for post in site.posts %}
{% if post.url == page.url %}
{% assign series = post.series %}
{% assign thisPost = post %}
{% endif %}
{% endfor %}
{% assign count = '0' %}
{% assign idx = '0' %}
{% for post in site.posts reversed %}
{% if post.series == 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> of <strong>{{ count }}</strong> in a series about <strong>{{thisPost.series_about}}</strong>.</p>
<ul>
{% assign count = '0' %}
{% for post in site.posts reversed %}
{% if post.series == series %}
{% capture count %}{{ count | plus: '1' }}{% endcapture %}
<li> Part {{ count }} -
{% if page.url == post.url %}
(current) - {{post.series_title}}
{% elsif post.published == false %}
{% comment %}trying to find a way to enable this... https://github.com/jekyll/help/issues/15{% endcomment %}
(coming soon) {{post.series_title}}
{% else %}
<a href="{{post.url}}">{{post.series_title}}</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% assign count = nil %}
{% assign idx = nil %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment