-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpost.hbs
165 lines (147 loc) · 6.68 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
{{!< default}}
{{!-- The tag above means: insert everything in this file into the body of the default.hbs template --}}
{{#post}}
{{#if primary_tag}}
{{#if primary_tag.accent_color}}
<style>
:root {
--section-color: {{primary_tag.accent_color}};
}
</style>
{{/if}}
{{/if}}
<main class="gh-main">
<article class="gh-article {{post_class}}">
{{^has tag="#Hide article header"}}
<header class="gh-article-header gh-canvas">
{{#if primary_tag}}
{{#primary_tag}}
<a class="gh-article-section{{#match slug "=" "catnip"}} rainbow-text{{/match}}" href="{{url}}"{{#if accent_color}} style="color: {{accent_color}}"{{/if}}>{{name}}</a>
{{/primary_tag}}
{{/if}}
<h1 class="gh-article-title is-title">{{title}}</h1>
{{#if custom_excerpt}}
<p class="gh-article-excerpt is-body">{{custom_excerpt}}</p>
{{/if}}
{{^has author="felix,anonymous"}}
<div class="gh-article-meta">
<div class="gh-article-author-image instapaper_ignore">
{{#foreach authors}}
{{#if profile_image}}
<a href="/author/{{slug}}/">
<img class="author-profile-image" src="{{img_url profile_image size="xs"}}" alt="{{name}}">
</a>
{{else}}
<a href="/author/{{slug}}/">{{> "icons/avatar"}}</a>
{{/if}}
{{/foreach}}
</div>
<div class="gh-article-meta-wrapper">
<h4 class="gh-article-author-name">{{#foreach authors}}{{#unless @first}}, {{/unless}}<a href="/author/{{slug}}/">{{name}}</a>{{/foreach}}</h4>
<div class="gh-article-meta-content">
<time class="gh-article-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date}}</time>
{{#if reading_time}}
<span class="gh-article-meta-length"><span class="bull">—</span> {{reading_time}}</span>
{{/if}}
</div>
</div>
</div>
{{/has}}
</header>
{{/has}}
<section class="gh-content gh-canvas is-body{{#if @custom.enable_drop_caps_on_posts}} drop-cap{{/if}}">
{{#has tag="#Show feature image,#import-hugo,#import-xelif"}}
{{> "feature-image"}}
{{/has}}
{{content}}
</section>
{{^has tag="#Show feature image,#import-hugo,#import-xelif"}}
{{#if feature_image_caption}}
<footer class="gh-article-footer gh-canvas">
<p>Feature image: {{feature_image_caption}}</p>
</footer>
{{/if}}
{{/has}}
</article>
{{#if @custom.show_edit_article_link}}
<div class="gh-comments gh-canvas">
<a href="/ghost/#/editor/post/{{id}}/">Edit this article</a>
</div>
{{/if}}
{{#if comments}}
<div class="gh-comments gh-canvas">
{{comments}}
</div>
{{/if}}
</main>
{{/post}}
{{#get "posts" order="published_at desc" include="tags"
filter="id:-{{post.id}}+tag:[{{post.tags.[0].slug}}]+tag:[{{post.tags.[1].slug}}]"}}
{{#match posts.length ">" "1"}}
<div class="gh-canvas">
<div class="gh-chapter-list">
<div class="gh-chapter-list-heading">
<h2><a href="{{posts.[0].tags.[0].url}}">{{posts.[0].tags.[0].name}}</a></h2>
<p>{{posts.[0].tags.[1].name}}</p>
</div>
<ul>
{{#foreach posts}}
<li class="chapter-list-item">
<a class="arrow-link"
href="{{url}}">{{title}} {{post.slug}}</a>
</li>
{{/foreach}}
</ul>
</div>
</div>
{{/match}}
{{/get}}
{{!-- Iterate over each tag, check if the tag has a slug starting with "issue-", output its details --}}
{{#foreach post.tags}}
{{#get "tags" filter="slug:~^'issue-'+slug:{{slug}}" limit="1" as |issue|}}
{{#issue}}
<div class="gh-canvas">
<div class="gh-issue{{#unless feature_image}} no-front-cover{{/unless}}">
{{> "feature-image"}}
<div class="gh-issue-description">
<h3>From <span class="gh-issue-name">{{name}}</span></h3>
{{!-- Since the date the tag was created is unreliable, instead get the oldest post with this tag. --}}
{{#if description}}
<em>{{description}}</em>
{{else}}
{{#get "posts" filter="tag:{{slug}}" order="published_at desc" limit="1" as |newest_post|}}
{{#newest_post}}
<em>
<time datetime="{{date format="YYYY-MM-DD"}}">{{date
format="Do MMMM YYYY"}}</time>
</em>
{{/newest_post}}
{{/get}}
{{/if}}
<p>Discover stories from this section and more in the list of contents</p>
<a class="arrow-link-filled" href="{{url}}">Explore the edition</a>
</div>
</div>
</div>
{{/issue}}
{{/get}}
{{/foreach}}
{{#if @custom.show_related_articles}}
<section class="gh-container is-grid gh-outer">
<div class="gh-container-inner gh-inner">
<h2 class="gh-container-title">Read more</h2>
<div class="gh-feed">
{{#get "posts" include="authors" order="published_at desc"
filter="id:-{{post.id}}+tag:[{{post.tags.[0].slug}}]+published_at:<'{{post.published_at}}'"
limit="4" as |contemporary|}}
{{#foreach contemporary}} {{> "post-card" lazyLoad=true}} {{/foreach}}
{{/get}}
{{#get "posts" include="authors,tags" order="published_at desc"
filter="id:-{{post.id}}+tag:-[{{post.tags.[0].slug}}]+published_at:>'{{post.published_at}}'"
limit="4" as |recent|}}
{{#foreach recent}} {{> "post-card" lazyLoad=true}} {{/foreach}}
{{/get}}
</div>
</div>
</section>
{{/if}}