mirror of
https://github.com/aljazceru/cryptoanarchywiki.github.io.git
synced 2025-12-17 05:04:21 +01:00
Update related posts
This commit is contained in:
@@ -7,3 +7,32 @@ layout: default
|
||||
<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 %}
|
||||
|
||||
Reference in New Issue
Block a user