File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,16 +22,32 @@ <h1 class="post-title">{{ page.title }}</h1>
2222< div class ="related ">
2323 < h2 > Related Posts</ h2 >
2424 < ul class ="related-posts ">
25- {% for post in site.related_posts limit:3 %}
26- < li >
27- < h3 >
28- < a href ="{{ post.url }} ">
29- {{ post.title }}
30- < small > {{ post.date | date_to_string }}</ small >
31- </ a >
32- </ h3 >
33- </ li >
25+ {% assign hasSimilar = '' %}
26+ {% for post in site.related_posts %}
27+ {% assign postHasSimilar = false %}
28+ {% for tag in post.tags %}
29+ {% for thisTag in page.tags %}
30+ {% if postHasSimilar == false and hasSimilar.size < 6 and post ! = page and tag == thisTag %}
31+ {% if hasSimilar.size == 0 %}
32+ < h4 > Similar Posts</ h4 >
33+ < ul >
34+ {% endif %}
35+ < li class ="relatedPost ">
36+ < a href ="{{ site.url }}{{ post.url }} "> {{ post.title }}
37+ {% if post.series %}
38+ (Series: {{ post.series }})
39+ {% endif %}
40+ </ a >
41+ </ li >
42+ {% capture hasSimilar %}{{ hasSimilar }}*{% endcapture %}
43+ {% assign postHasSimilar = true %}
44+ {% endif %}
45+ {% endfor %}
46+ {% endfor %}
3447 {% endfor %}
48+ {% if hasSimilar.size > 0 %}
49+ </ ul >
50+ {% endif %}
3551 </ ul >
3652</ div >
3753
You can’t perform that action at this time.
0 commit comments