francescomecca.eu/_layouts/post.html
2016-09-17 15:13:02 +02:00

53 lines
1.6 KiB
HTML

---
layout: default
---
<div class="post">
<h1 class="post-title">{{ page.title }}</h1>
<span class="post-date">{{ page.date | date_to_string }}</span>
{{ content }}
</div>
<!--<div class="related">-->
<!--<related-posts />-->
<!--<h2>Related Posts</h2>-->
<!--<ul class="related-posts">-->
<!--{% for post in site.related_posts limit:5 %}-->
<!--<li>-->
<!--<h3>-->
<!--<a href="{{ post.url }}">-->
<!--{{ post.title }}-->
<!--<small>{{ post.date | date_to_string }}</small>-->
<!--</a>-->
<!--</h3>-->
<!--</li>-->
<!--{% endfor %}-->
<!--</ul>-->
<!--</div>-->
{% assign hasSimilar = '' %}
{% for post in site.related_posts %}
{% assign postHasSimilar = false %}
{% for tag in post.tags %}
{% for thisTag in page.tags %}
{% if postHasSimilar == false and hasSimilar.size < 6 and post != page and tag ==
thisTag %}
{% if hasSimilar.size == 0 %}
<h4>Similar Posts</h4>
<ul>
{% endif %}
<li class="relatedPost">
<a href="{{ site.url }}{{ post.url }}">{{ post.title }}
{% if post.series %}
(Series: {{ post.series }})
{% endif %}
</a>
</li>
{% capture hasSimilar %}{{ hasSimilar }}*{% endcapture %}
{% assign postHasSimilar = true %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% if hasSimilar.size > 0 %}
</ul>
{% endif %}