-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.html
117 lines (95 loc) · 2.74 KB
/
post.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
layout: default
---
<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
<header class="post-header">
<h1 class="post-title p-name" itemprop="name headline">{{ page.title | escape }}</h1>
<p class="post-meta">
<time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
{{ page.date | date: date_format }}
</time>
{%- if page.author -%}
• <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span class="p-author h-card" itemprop="name">{{ page.author }}</span></span>
{%- endif -%}</p>
<p>
{%- assign tag_urlprefix = "../../../" -%}
{%- assign ctags = page.tags -%}
{%- include tags-cloud.md -%}
</header>
<div class="post-content e-content" itemprop="articleBody">
{{ content }}
</div>
{%- if site.disqus.shortname -%}
{%- include disqus_comments.html -%}
{%- endif -%}
<a class="u-url" href="{{ page.url | relative_url }}" hidden></a>
</article>
<p>
{%- include prev-next.html -%}
<div class="related-posts">
<h3 class="related-posts-header">Related Posts</h3>
{% assign MAX_RELATED_POSTS = 4 %}
{% assign MIN_COMMON_TAGS = 2 %}
{% assign num_related_counter = 0 %}
{% for post in site.posts %}
{% if post == page %}
{% continue %}
{% endif %}
{% assign related_tag_count = 0 %}
<!-- Find Related Tags Collection -->
{% assign ctags = "" %}
{% for tag in post.tags %}
{% if page.tags contains tag %}
{% assign ctags = ctags | join:' ' | append:' ' | append: tag | split:' ' %}
{% endif %}
{% endfor %}
{% assign nb_related_tags = ctags | size %}
{% if nb_related_tags >= MIN_COMMON_TAGS %}
<div class="related-posts-item navigation"><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
{%- include tags-cloud.md -%}
{% assign num_related_counter = num_related_counter | plus: 1 %}
{% if num_related_counter >= MAX_RELATED_POSTS %}
{% break %}
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
{% if num_related_counter == 0 %}
<!-- No related posts found. Hiding Block -->
<style>
.related-posts {
display: none;
}
</style>
{% endif %}
<style>
.related-posts-header {
}
.related-posts {
border-top: 3px solid #333;
border-top: 0px;
padding-top: 15px;
margin: 0 auto;
text-align: left;
}
.related-posts-item {
width: 23%;
display: inline-grid;
padding: 5px;
}
.related-posts-item > .tags-cloud {
text-align: center;
}
.navigation {
opacity: 1;
font-size: small;
}
.navigation:hover {
opacity: 1;
}
.previous-next {
margin: 4 auto;
}
</style>