Improved the example template code in the readme

The old example wasn't great - you end up with the heading as the first item in the list, and the if statement is un-necessarily long.
This commit is contained in:
Duncan Lock
2013-07-11 13:15:43 -07:00
parent 9ecd38ecd2
commit 65749d8987

View File

@@ -13,20 +13,12 @@ to display other parts of current post.
For example: For example:
{% if article.metadata.parts_articles %} {% if article.metadata.parts_articles %}
<p>This post is part of a series:</p>
<ol class="parts"> <ol class="parts">
<li>Post parts</li> {% for part_article in article.metadata.parts_articles %}
{% for part_article in article.metadata.parts_articles %} <li {% if part_article == article %}class="active"{% endif %}>
{% if part_article == article %} <a href='{{ SITEURL }}/{{ part_article.url }}'>{{ part_article.title }}</a>
<li class="active">
<a href='{{ SITEURL }}/{{ part_article.url }}'>{{ part_article.title }}
</a>
</li> </li>
{% else %} {% endfor %}
<li>
<a href='{{ SITEURL }}/{{ part_article.url }}'>{{ part_article.title }}
</a>
</li>
{% endif %}
{% endfor %}
</ol> </ol>
{% endif %} {% endif %}