forked from GetPublii/theme-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.hbs
executable file
·121 lines (113 loc) · 5.11 KB
/
index.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
{{> head}}
<main class="main main--grid {{#checkIfNone @config.custom.sidebar}}main--full{{/checkIfNone}}">
{{!-- "isFirstPage" global variable is used here; with this when pagination is displayed the second and following pages of posts are displayed without a hero and featured post section. --}}
{{#if @renderer.isFirstPage}}
{{#checkIfAny @config.custom.uploadHero @config.custom.textHero}}
<div class="hero">
{{#if @config.custom.uploadHero}}
<img
src="{{@config.custom.uploadHero}}"
{{responsiveSrcSet @config.custom.uploadHero}}
{{responsiveSizes}}
alt="{{@config.custom.uploadHeroAlt}}"
{{#if @config.custom.uploadHeroTitle}}
title="{{@config.custom.uploadHeroTitle}}"
{{/if}}
class="hero__image">
{{/if}}
{{#if @config.custom.textHero}}
<div class="hero__text">
{{{@config.custom.textHero}}}
</div>
{{/if}}
</div>{{!-- .hero --}}
{{/checkIfAny}}
{{#if featuredPosts}}
<div class="featured-posts">
<h3 class="box__title">Featured posts</h3>
{{#each featuredPosts}}
{{#checkIf @index '<' 3}}
{{!-- With this we can specify how many featured posts are displayed. --}}
<article class="article">
{{#featuredImage}}
{{#if url}}
<a href="{{../url}}">
<img
src="{{url}}"
sizes="{{sizes.listing}}"
srcset="{{srcset.listing}}"
alt="{{alt}}">
</a>
{{/if}}
{{/featuredImage}}
<header>
<h2 class="article__title">
<a href="{{url}}">{{title}}</a>
</h2>
</header>
{{#if excerpt}}
<p>{{{excerpt}}}</p>
{{/if}}
<p class="article__meta u-small">
<time datetime="{{date createdAt 'YYYY-MM-DDTHH:mm'}}">
{{#checkIf @config.custom.formatDate '!=' 'custom'}}
{{date createdAt @config.custom.formatDate}}
{{else}}
{{date createdAt @config.custom.formatDateCustom}}
{{/checkIf}}
</time>
</p>
</article>
{{/checkIf}}
{{/each}}
</div>{{!-- .featured-posts --}}
{{/if}}
{{/if}}
{{#each posts}}
<article class="article">
{{#featuredImage}}
{{#if url}}
<a href="{{../url}}" class="card__image">
<img
src="{{url}}"
sizes="{{sizes.listing}}"
srcset="{{srcset.listing}}"
alt="{{alt}}">
</a>
{{/if}}
{{/featuredImage}}
<header>
<h2 class="article__title">
<a href="{{url}}">{{title}}</a>
</h2>
{{#if hasCustomExcerpt}}
{{{ excerpt }}}
{{else}}
<p>{{{ excerpt }}}</p>
{{/if}}
<p class="article__meta u-small">
{{#author}}
<a href="{{url}}" title="{{name}}">
{{#if avatar}}
<img src="{{avatar}}" class="article__meta__avatar" alt="{{name}}">
{{/if}}
{{name}}
</a>
{{/author}}
<time datetime="{{date createdAt 'YYYY-MM-DDTHH:mm'}}">
{{#checkIf @config.custom.formatDate '!=' 'custom'}}
{{date createdAt @config.custom.formatDate}}
{{else}}
{{date createdAt @config.custom.formatDateCustom}}
{{/checkIf}}
</time>
</p>
</header>
</article>
{{/each}}
{{> pagination}}
</main>
{{#if @config.custom.sidebar}}
{{> sidebar}}
{{/if}}
{{> footer}}