-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost.html
109 lines (98 loc) · 4 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
---
layout: default
---
{% assign chars_left = 280 %}
{% assign url = site.url | append: page.url | uri_escape | replace: "%20", "%2520" %}
{% assign chars_left = chars_left | minus: 24 %}
{% assign via = site.twitter.username | uri_escape %}
{% assign chars_left = chars_left | minus: 16 %}
{% assign tags_raw = '' %}
{% assign tags_size = 0 %}
{% for tag in page.keywords %}
{% assign tag_final = tag | strip_html | strip_newlines | replace: ' ', '_' | strip %}
{% assign tag_size = tag_final | size %}
{% assign tags_size = tags_size | plus: tag_size | plus: 2 %}
{% if tags_size > 30 %}
{% break %}
{% endif %}
{% if forloop.first == true %}
{% assign tags_raw = tags_raw | append: tag_final %}
{% else %}
{% assign tags_raw = tags_raw | append: ',' | append: tag_final %}
{% endif %}
{% endfor %}
{% assign tags = tags_raw | uri_escape %}
{% assign chars_left = chars_left | minus: tags_size %}
{% assign intro = content | newline_to_br | strip_newlines | replace: '<br />', ' ' | strip_html | strip_newlines | replace: ',', '.' | replace: '!', '.' | replace: ':', '\.' | replace: '?', '\.' | split: '.' | first | strip %}
{% assign text = page.title | append: ': ' | append: intro | strip_html | strip_newlines | truncate: chars_left | uri_escape | strip %}
<div class="row">
<div class="col-md-10 text-center">
<span class="float-md-left">
<span class="time">{{ page.date | date_to_string }}</span>
{% if page.categories %}
<span class="categories">
» {% for category in page.categories %}<a href="/category/{{ category }}">{{ category }}</a>{% if forloop.last == false %}, {% endif %}{% endfor %}
</span>
{% endif %}
</span>
</div>
<div class="col-md-2 text-center social-media">
<span class="float-md-right">
<a class="reddit" href="https://www.reddit.com/submit?title={{ text }}&url={{ url }}">
{% include img/reddit.svg %}
</a>
<a class="twitter" href="https://twitter.com/intent/tweet?text={{ text }}&url={{ url }}&hashtags={{ tags }}&via={{ via }}">
{% include img/twitter.svg %}
</a>
</span>
</div>
</div>
<div class="post">
{{ content }}
</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 }}</a>
{% if post.categories %}
(Categories: {% for category in post.categories %}<a href="/category/{{ category }}">{{ category }}</a>{% if forloop.last == false %}, {% endif %}{% endfor %})
{% endif %}
</li>
{% capture hasSimilar %}{{ hasSimilar }}*{% endcapture %}
{% assign postHasSimilar = true %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% if hasSimilar.size > 0 %}
</ul>
</div>
{% endif %}
<div class="row post-navigation">
<div class="col-md-6 text-center">
<span class="float-md-left">
{% if page.next.url %}
<a href="{{ page.next.url }}">« {{ page.next.title }} «</a>
{% endif %}
</span>
</div>
<div class="col-md-6 text-center">
<span class="float-md-right">
{% if page.previous.url %}
<a href="{{ page.previous.url }}">» {{ page.previous.title }} »</a>
{% endif %}
</span>
</div>
</div>
<div class="post-comment">
<section id="isso-thread"></section>
</div>