forked from TryGhost/Casper
-
Notifications
You must be signed in to change notification settings - Fork 2
/
post.hbs
253 lines (224 loc) · 12.7 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
{{!< default}} {{!-- The tag above means: insert everything in this file into the {body} of the default.hbs template
--}} <header class="site-header">
{{> site-header}}
</header>
{{!-- Everything inside the #post tags pulls data from the post --}}
{{#post}}
<main id="site-main" class="site-main outer">
<div class="inner">
<div class="single-post">
<article class="post-full {{post_class}} {{#unless feature_image}}no-image{{/unless}}">
{{#if feature_image}}
<figure class="post-full-image">
{{!-- This is a responsive image, it loads different sizes depending on device
https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433
--}}
<img srcset="{{img_url feature_image size=" s"}} 300w, {{img_url feature_image size="m" }} 600w,
{{img_url feature_image size="l" }} 1000w, {{img_url feature_image size="xl" }} 2000w"
sizes="(max-width: 800px) 400px,
(max-width: 1170px) 1170px,
2000px" src="{{img_url feature_image size=" xl"}}" alt="{{title}}" />
</figure>
{{/if}}
<header class="post-full-header">
{{#if primary_tag}}
<section class="post-full-tags">
{{#primary_tag}}
<a class="tag" href="{{url}}">{{name}}</a>
{{/primary_tag}}
</section>
{{/if}}
<h1 class="post-full-title">{{title}}</h1>
{{#if custom_excerpt}}
<p class="post-full-custom-excerpt">{{custom_excerpt}}</p>
{{/if}}
{{!-- <div class="post-full-byline"> --}}
<section class="post-full-byline-content">
<ul class="author-list">
{{#foreach authors}}
<li class="author-list-item">
<div class="author-card">
{{#if profile_image}}
<img class="author-profile-image" src="{{img_url profile_image size=" xs"}}"
alt="{{name}}" />
{{else}}
<div class="author-profile-image">{{> "icons/avatar"}}</div>
{{/if}}
<div class="author-info">
{{#if bio}}
<div class="bio">
<h2>{{name}}</h2>
<p>{{bio}}</p>
<p><a href="{{url}}">More posts</a> by {{name}}.</p>
</div>
{{else}}
<h2>{{name}}</h2>
<p>Read <a href="{{url}}">more posts</a> by this author.</p>
{{/if}}
</div>
</div>
{{#if profile_image}}
<a href="{{url}}" class="author-avatar">
<img class="author-profile-image" src="{{img_url profile_image size=" xs"}}"
alt="{{name}}" />
</a>
{{else}}
<a href="{{url}}" class="author-avatar author-profile-image">{{>
"icons/avatar"}}</a>
{{/if}}
</li>
{{/foreach}}
</ul>
<section class="post-full-byline-meta">
<h4 class="author-name">{{authors}}</h4>
<div class="byline-meta-content">
<time class="byline-meta-date" datetime="{{date format=" YYYY-MM-DD"}}">{{date
format="D MMM YYYY"}}</time>
<span class="byline-reading-time"><span class="bull">•</span>
{{reading_time minute="1 МИН" minutes="% МИН"}}</span>
</div>
</section>
</section>
{{!--
</div> --}}
</header>
<div class="post-full-byline">
<section class="post-full-content">
<div class="post-content">
{{content}}
</div>
<div id="disqus_thread" style="margin-top: 70px;"></div>
</section>
</div>
</article>
{{!-- Links to Previous/Next posts --}}
<aside class="aside-box">
<div class="read-next-feed">
{{#if primary_tag}}
{{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" include="tags,authors" as
|related_posts|}}
{{#if related_posts}}
<article class="read-next-card">
<header class="read-next-card-header">
<h3>Вам также может понравиться</h3>
</header>
<div class="read-next-card-content">
<ul>
{{#foreach related_posts}}
<li class="post-full-byline">
<h4><a href="{{url}}">{{title}}</a></h4>
<div class="read-next-card-meta">
<div class="author-avatar">
{{#if primary_author.profile_image}}
<img class="author-profile-image" src="{{primary_author.profile_image}}"
alt="{{primary_author.name}}" />
{{else}}
<span class="author-profile-image">{{> "icons/avatar"}}</span>
{{/if}}
</div>
<div class="post-card-byline-content">
<span>{{#has author="count:>2"}}Multiple
authors{{else}}{{authors}}{{/has}}</span>
<span class="post-card-byline-date"><time datetime="{{date format="
YYYY-MM-DD"}}">{{date format="DD.MM.YYYY"}}</time> <span
class="bull">•</span> {{reading_time minute="1 МИН"
minutes="%
МИН"}}</span>
</div>
{{!-- <div class="author-avatar">
{{#if primary_author.profile_image}}
<img class="author-profile-image" src="{{primary_author.profile_image}}"
alt="{{primary_author.name}}" />
{{else}}
<span class="author-profile-image">{{> "icons/avatar"}}</span>
{{/if}}
</div>
<div>
{{#if primary_author.name}}
<span class="author-name">
{{primary_author.name}}
</span>
{{/if}}
<p><time datetime="{{date format=" YYYY-MM-DD"}}">{{date
format="DD.MM.YYYY"}}</time> •
{{reading_time minute="1 мин" minutes="% мин"}}</p>
</div> --}}
</div>
</li>
{{/foreach}}
</ul>
</div>
<footer class="read-next-card-footer ">
<a class="btn btn--black--outlined btn--full-width"
href="{{#../primary_tag}}{{url}}{{/../primary_tag}}"><span
class="btn-title">Смотреть все</span>
<svg class="btn-icon--black" viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#arrow-right"></use>
</svg>
</a>
</footer>
</article>
{{/if}}
{{/get}}
{{/if}}
</div>
</aside>
</div>
</div>
<div class="inner">
{{!-- Email subscribe form at the bottom of the page --}}
{{#if @labs.members}}
{{> subscribe-form}}
{{/if}}
{{!--
<section class="post-full-comments">
If you want to embed comments, this is a good place to do it!
</section>
--}}
<section class="post-full-comments">
<script>
(function () {
var d = document, s = d.createElement('script');
s.src = 'https://https-smmplanner-com.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>
</section>
</div>
</main>
{{/post}}
{{!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in
default.hbs --}}
{{#contentFor "scripts"}}
<script>
$(document).ready(function () {
// FitVids - start
var $postContent = $(".post-full-content");
$postContent.fitVids();
// FitVids - end
// Replace nav with title on scroll - start
Casper.stickyNavTitle({
navSelector: '.site-nav-main',
titleSelector: '.post-full-title',
activeClass: 'nav-post-title-active'
});
// Replace nav with title on scroll - end
// Hover on avatar
var hoverTimeout;
$('.author-list-item').hover(function () {
var $this = $(this);
clearTimeout(hoverTimeout);
$('.author-card').removeClass('hovered');
$(this).children('.author-card').addClass('hovered');
}, function () {
var $this = $(this);
hoverTimeout = setTimeout(function () {
$this.children('.author-card').removeClass('hovered');
}, 800);
});
});
</script>
{{/contentFor}}