forked from GetPublii/theme-Blank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.hbs
216 lines (187 loc) · 7.92 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
{{! Post page; this file renders a single post and loads all the content}}
{{> head}}
{{> navbar}}
<main>
{{! injects code via a Custom HTML tool - as defined in the config.json file in the "renderer" section }}
{{#if @customHTML.beforePost}}
<div id="custom-html-before-post">
{{{@customHTML.beforePost}}}
</div>
{{/if}}
{{! /injects code via a Custom HTML tool }}
{{! indicates the post's context}}
{{#post}}
<article>
<header>
{{! post title }}
<h1>
{{title}}
</h1>
{{! /post title }}
{{! post creation date }}
<time datetime="{{date createdAt 'YYYY-MM-DDTHH:mm'}}">
{{date createdAt}}
</time>
{{! /post creation date }}
{{! post author }}
{{ translate 'post.publishedBy' }}
{{#author}}
<a href="{{url}}" rel="author" title="{{name}}">{{name}}</a>
{{/author}}
{{! /post author }}
{{! main tag - if not selected, the first tag in the list of all tags will be displayed }}
{{#if mainTag}}
<a href="{{ mainTag.url }}" class="post__maintag">
{{mainTag.name }}
</a>
{{/if}}
{{! /main tag }}
{{! post modification date }}
{{#if modifiedAt}}
{{ translate 'post.lastUpdatedDate' }}
<time datetime="{{date modifiedAt 'YYYY-MM-DDTHH:mm'}}">
{{date modifiedAt}}
</time>
{{/if}}
{{! /post modification date }}
</header>
{{! featured image }}
{{#featuredImage}}
{{! check if an image exists }}
{{#if url}}
<figure id="featured-image">
<img
src="{{url}}"
{{! checks if the Responsive Images option (located in Site Settings -> Website Speed) is enabled }}
{{#if @config.site.responsiveImages}}
{{responsiveImageAttributes 'featuredImage' srcset sizes}}
{{/if}}
{{! generates a native loading attribute; if the Media Lazy Load option (located in Site Settings -> Website Speed) is disabled, the loading attribute is not generated }}
{{ lazyload "eager" }}
height="{{height}}"
width="{{width}}"
alt="{{alt}}">
{{! checks if the caption or credits exist }}
{{#checkIfAny caption credits}}
<figcaption>
{{caption}}
{{credits}}
</figcaption>
{{/checkIfAny}}
{{! /checks if the caption or credits exist }}
</figure>
{{/if}}
{{! /check if an image exists }}
{{/featuredImage}}
{{! /featured image }}
{{! post body }}
<div id="post-entry">
{{{text}}}
</div>
{{! /post body }}
{{! checks if the "displayAuthorBio" post option is enabled - the Post Options are defined in the config.json in the "postConfig" section, and are accessible in the Theme -> Post Options section of Publii and in the post editor itself in the sidebar -> Other Options section }}
{{#if @config.post.displayAuthorBio}}
{{! author bio section }}
{{#author}}
<div id="author-bio">
{{! checks if an author avatar exists }}
{{#if avatar}}
<img
src="{{avatarImage.url}}"
{{ lazyload "lazy" }}
alt="{{avatarImage.alt}}"
height="{{avatarImage.height}}"
width="{{avatarImage.width}}">
{{/if}}
{{! /checks if an author avatar exists }}
{{! displays the author's name with a link to the author's page }}
<h3>
<a href="{{url}}" title="{{name}}">{{name}}</a>
</h3>
{{! /displays the author's name with a link to the author's page }}
{{! checks if an author description exists }}
{{#if description}}
<div> {{{description}}} </div>
{{/if}}
{{! /checks if an author description exists }}
</div>
{{/author}}
{{! /author bio section }}
{{/if}}
{{! /check if the "displayAuthorBio" Post option is enabled }}
{{! previous & next post }}
{{! checks if there are any posts besides the current one; including ../ segment on a path, we change the post context into the parent context }}
{{#checkIfAny ../previousPost ../nextPost}}
<nav id="post-navigation">
{{#../previousPost}}
<a href="{{url}}" rel="prev">
← {{ translate 'post.previousPost' }}
({{title}})
</a>
{{/../previousPost}}
{{#../nextPost}}
<a href="{{url}}" rel="next">
{{ translate 'post.nextPost' }}
({{title}}) →
</a>
{{/../nextPost}}
</nav>
{{/checkIfAny}}
{{! /checks if there are any posts besides the current one }}
{{! /previous & next post }}
{{! related posts - defined in config.json file in the "renderer" section }}
{{! checks if there is any related post; including ../ segment on a path, we change the post context into the parent context }}
{{#if ../relatedPosts}}
<div id="related-posts">
<h3>
{{ translate 'post.relatedPosts' }}
</h3>
<div>
{{! loop that generates a list of related posts}}
{{#each ../relatedPosts}}
<section>
{{#featuredImage}}
{{#if url}}
<a href="{{../url}}" >
<img
src="{{url}}"
{{#if @config.site.responsiveImages}}
{{responsiveImageAttributes 'featuredImage' srcset sizes}}
{{/if}}
{{ lazyload "lazy" }}
height="{{height}}"
width="{{width}}"
alt="{{alt}}">
</a>
{{/if}}
{{/featuredImage}}
<h4>
<a href="{{url}}">{{title}}</a>
</h4>
<p>{{{ excerpt }}}</p>
</section>
{{/each}}
{{! /loop that generates a list of related posts}}
</div>
</div>
{{/if}}
{{! /check if there is any related post }}
{{! /related posts }}
</article>
{{/post}}
{{! /indicates the post's context}}
{{! display comments plugin: it requires the "customComments" flag to be enabled in the "supportedFeatures" section of the config.json file}}
{{{@commentsCustomCode}}}
{{! /display comments plugin}}
{{! code injection by a Custom HTML tool - defined in config.json file in the renderer section}}
{{#if @customHTML.afterPost}}
<div id="custom-html-after-post">
{{{@customHTML.afterPost}}}
</div>
{{/if}}
{{! injects code via a Custom HTML tool }}
</main>
<aside>
{{> sidebar}}
</aside>
{{> footer}}