Files
cryptoanarchywiki.github.io/_layouts/post.html
2016-04-19 16:22:55 +07:00

39 lines
1.2 KiB
HTML

---
layout: default
---
<h1>{{ page.title }}</h1>
<span class="time">{{ page.date | date_to_string }}</span>
<div class="content">
<div class="post">{{ content }}</div>
</div>
{% assign hasSimilar = '' %}
{% for post in site.posts %}
{% assign postHasSimilar = false %}
{% for tag in post.categories %}
{% for thisTag in page.categories %}
{% if postHasSimilar == false and hasSimilar.size < 6 and post != page and tag == thisTag %}
{% if hasSimilar.size == 0 %}
<div class="panel-body">
<h4>Related Posts</h4>
<ul>
{% endif %}
<li class="relatedPost">
<a href="{{ site.url }}{{ post.url }}">{{ post.title }}
{% if post.categories %}
(Categories: {{ post.categories | join: ', ' }})
{% endif %}
</a>
</li>
{% capture hasSimilar %}{{ hasSimilar }}*{% endcapture %}
{% assign postHasSimilar = true %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% if hasSimilar.size > 0 %}
</ul>
</div>
{% endif %}