forked from hydecorp/hydejack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
related.html
41 lines (39 loc) · 1.33 KB
/
related.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{% assign post = include.post %}
<aside class="related" role="complementary">
<h2 class="hr">Related Posts</h2>
<ul class="related-posts">
{% if site.use_lsi %}
{% for post in site.related_posts limit:3 %}
{% include post-list-item.html post=post %}
{% endfor %}
{% elsif post.categories.first %}
{% assign category_posts = site.categories[post.categories.first] %}
{% assign plusone = false %}
{% for post in category_posts limit:4 %}
{% if post.url == page.url %}
{% assign plusone = true %}
{% continue %}
{% endif %}
{% if forloop.index < 4 or plusone == true %}
{% include post-list-item.html post=post %}
{% endif %}
{% endfor %}
{% elsif post.tags.first %}
{% assign tag_posts = site.tags[post.tags.first] %}
{% assign plusone = false %}
{% for post in tag_posts limit:4 %}
{% if post.url == page.url %}
{% assign plusone = true %}
{% continue %}
{% endif %}
{% if forloop.index < 4 or plusone == true %}
{% include post-list-item.html post=post %}
{% endif %}
{% endfor %}
{% else %}
{% for post in site.related_posts limit:3 %}
{% include post-list-item.html post=post %}
{% endfor %}
{% endif %}
</ul>
</aside>