-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathpost.hbs
176 lines (151 loc) · 8.25 KB
/
post.hbs
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
{{!< default}}
{{!-- The tag above means: insert everything in this file
into the {body} of the default.hbs template --}}
{{#contentFor "styles"}}
<link rel="stylesheet" type="text/css" href="{{asset "styles/post.css"}}"/>
{{/contentFor}}
{{!-- Everything inside the #post tags pulls data from the post --}}
{{#post}}
<main id="site-main" class="site-main">
<div class="grid-container post-container">
<article class="post-full {{post_class}} {{#unless feature_image}}no-image{{/unless}}">
<header class="post-full-header">
{{#if feature_image}}
<figure class="post-full-image">
<div class="post-full-image-background"></div>
<img src="{{feature_image}}" crossorigin="anonymous" />
{{> "spinkit"}}
<section class="post-full-meta-feature">
<div class="post-date">
<i class="far fa-calendar-alt"></i> <time class="post-full-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date format="D MMMM YYYY"}}</time>
</div>
{{#primary_tag}}
<div class="primary-tag">
<i class="fas fa-tag"></i> <a href="{{url}}" class="meta-tag">{{name}}</a>
</div>
{{/primary_tag}}
</section>
</figure>
{{/if}}
<div class="title-wrapper">
<h1 class="post-full-title">{{title}}</h1>
</div>
{{#unless feature_image}}
<section class="post-full-meta">
<div class="post-date">
<i class="far fa-calendar-alt"></i> <time class="post-full-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date format="D MMMM YYYY"}}</time>
</div>
{{#primary_tag}}
<div class="primary-tag">
<div class="meta-divider"></div> <i class="fas fa-tag"></i> <a href="{{url}}" class="meta-tag">{{name}}</a>
</div>
{{/primary_tag}}
</section>
{{/unless}}
</header>
<section class="post-full-content">
<div class="post-content">
{{content}}
</div>
</section>
<footer class="post-full-footer">
{{!-- There are two options for how we display the byline/author-info.
If the post has more than one author, we load a specific template
from includes/byline-multiple.hbs, otherwise, we just use the
default byline. --}}
<div class="post-full-container">
{{#has author="count:>1"}}
{{> "byline-multiple"}}
{{else}}
{{> "byline-single"}}
{{/has}}
{{> "share-post"}}
</div>
</footer>
</article>
</div>
</main>
{{!-- Links to Previous/Next posts --}}
<section id="read-next" class="read-next">
<div class="grid-container">
<div class="related-articles">
{{#if primary_tag}}
{{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related_posts|}}
{{#if related_posts}}
<article class="read-next-card post-card no-image"
style="background: url(
{{#if ../primary_tag.feature_image}}
{{../primary_tag.feature_image}}
{{else}}
{{#if @site.cover_image}}
{{@site.cover_image}}
{{else}}
{{asset "img/photo-1523980669340-3d154e47d5fd.jpg"}}
{{/if}}
{{/if}}
) no-repeat center center; background-size: cover;"
>
<div class="post-card-inner">
<div class="post-card-content">
<header class="read-next-card-header">
{{#../primary_tag}}
<h3 class="read-next-card-header-title">
<a href="{{url}}"><i class="fas fa-bookmark"></i> {{name}}</a>
</h3>
{{/../primary_tag}}
</header>
<div class="read-next-card-content">
<ul>
{{#foreach related_posts}}
<li><a href="{{url}}">{{title}}</a></li>
{{/foreach}}
</ul>
</div>
<footer class="read-next-card-footer">
<a href="{{#../primary_tag}}{{url}}{{/../primary_tag}}">{{plural meta.pagination.total empty='No posts' singular='% post' plural='See all % posts'}} →</a>
</footer>
</div>
</div>
</article>
{{/if}}
{{/get}}
{{/if}}
{{!-- If there's a next post, display it using the same markup included from - partials/post-card.hbs --}}
{{#next_post}}
{{> "feed-card"}}
{{/next_post}}
{{!-- If there's a previous post, display it using the same markup included from - partials/post-card.hbs --}}
{{#prev_post}}
{{> "feed-card"}}
{{/prev_post}}
</div>
</div>
</section>
{{!-- Comments --}}
<section id="comments" class="comments">
<div class="grid-container">
<div class="comments-container">
<h3>Comments:</h3>
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{url absolute="true"}}'; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = '{{comment_id}}'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.async = true;
s.src = 'https://[your-disqus-name].disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
</section>
{{/post}}
{{!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs --}}
{{#contentFor "scripts"}}
<script type="text/javascript" defer src="{{asset "/scripts/post.js"}}"></script>
{{/contentFor}}