-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.html
225 lines (195 loc) · 7.64 KB
/
template.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!--w3c-->
<title property="schema:name">${data['title']}</title>
<meta name="title" content="${data['title']}">
<meta name="description" content="${data['description']}">
<!--schema.org-->
<meta property="schema:name" content="${data['title']}">
<meta property="schema:description" content="${data['description']}">
<!-- opengraph-->
<meta property="og:title" content="${data['title']}">
<meta property="og:description" content="${data['description']}">
<!-- linkedin -->
<meta name="author" content="Matthew Davis">
<meta property="og:type" content="website" />
% if data['template'] == 'home':
<meta property="og:url" content="https://www.mdavis.xyz/" /> <!-- end with / -->
% else:
<meta property="og:url" content="https://www.mdavis.xyz/${data['publishPath'].rstrip('/')}/" /> <!-- end with / -->
% endif
% if 'attribution' in data['images']['card']:
<!-- ${data['images']['card']['attribution']} -->
% endif
<!-- image path must be full, absolute -->
% if data['template'] == 'home':
<meta property="og:image" content="https://www.mdavis.xyz/${data['images']['card']['path']}" />
<meta property="og:image:width" content="${data['images']['card']['width']}" />
<meta property="og:image:height" content="${data['images']['card']['height']}" />
<meta property="og:image:alt" content="${data['images']['card']['description']}" />
% elif 'social' in data['images']:
<meta property="og:image" content="https://www.mdavis.xyz/${data['publishPath']}/${data['images']['social']['path']}" />
<meta property="og:image:width" content="${data['images']['social']['width']}" />
<meta property="og:image:height" content="${data['images']['social']['height']}" />
<meta property="og:image:alt" content="${data['images']['social']['description']}" />
% else:
<meta property="og:image" content="https://www.mdavis.xyz/${data['publishPath']}/${data['images']['card']['path']}" />
<meta property="og:image:width" content="${data['images']['card']['width']}" />
<meta property="og:image:height" content="${data['images']['card']['height']}" />
<meta property="og:image:alt" content="${data['images']['card']['description']}" />
% endif
<meta property="og:author" content="Matthew Davis" />
<meta property="og:site_name" content="Matthew Davis's Blog" />
% if ('date' in data) and ('human' in data['date']) and (data['template'] != 'home'):
<meta name="displaydate" content="${data['date']['human']}">
% endif
% if 'viewport' not in data['exclude']:
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
% endif
<link rel="stylesheet" type="text/css" href="styles.css" />
<link rel="stylesheet" type="text/css" href="${"" if data['template'] == 'home' else "../"}common.css" />
% if 'mediaCSS' not in data['exclude']:
<link rel="stylesheet" type="text/css" href="${"" if data['template'] == 'home' else "../"}media.css" />
% endif
<link rel="alternate"
type="application/rss+xml"
title="RSS"
href="${"" if data['template'] == 'home' else "../"}rss.xml" />
% if 'script' not in data['exclude']:
<script src="script.js" ></script>
% endif
% for s in data.get('extra_scripts', []):
<script src="${s}" ></script>
% endfor
<script src="${"" if data['template'] == 'home' else "../"}source.js" ></script>
</head>
<body>
% if 'appear' not in data['exclude']:
<div class="appear">
% endif
% if 'article' not in data['exclude']:
<article>
<header>
<h1 id="title">${data['title']}</h1>
<p id="subtitle" class="subtitle">${data['description']}</p>
</header>
% if 'top' in data['images']:
<p class="topimagecont" id="topimagecont">
% if data['images']['top']['path'].lower().endswith('.mp4'):
<video class="graph video topimage"
autoplay
loop
autobuffer
muted
playsinline
video-auto-ctrl
preload
defaultMuted
width="${data['images']['top']['width']}"
height="${data['images']['top']['height']}">
<source src="${data['images']['top']['path']}" type="video/mp4" />
</video>
% else:
<img id="TopImage"
class="topimage roundAndShadow"
src="${data['images']['top']['path']}"
alt="${data['images']['top']['description']}"
width="${data['images']['top']['width']}"
height="${data['images']['top']['height']}" />
% endif
</p>
% endif
<div class="authordate center">
<a id="author" href="../">
<div class="metaline">
<img
class="logo"
src="${"" if data['template'] == 'home' else "../"}images/user.svg"
alt=""
width="20"
height="20" />
<span class="byline-name">
Matthew Davis
</span>
</div>
</a>
% if 'date' not in data['exclude']:
<div class="metalinesep">
|
</div>
<div class="metaline">
<img
class="logo"
src="${"" if data['template'] == 'home' else "../"}images/calendar.svg"
alt=""
width="20"
height="20" />
<time datetime="${data['date']['computer']}" class="dateline">
${data['date']['human']}
</time>
</div>
% endif
% if ('estReadingTime' in data) and ('estReadingTime' not in data['exclude']) and (data['estReadingTime'] > 1.5) and (data['path'] != 'govlist'):
<div class="metalinesep">
|
</div>
<div class="metaline">
<img
class="logo"
src="${"" if data['template'] == 'home' else "../"}images/stopwatch.svg"
alt=""
width="20"
height="20" />
${'%d' % int(data['estReadingTime'])} min
</div>
% endif
</div>
% if ('disclaimer' in data) or (('top' in data['images']) and ('attribution' in data['images']['top'])):
<aside>
% if 'disclaimer' in data:
<p class="disclaimer">
${data['disclaimer']}
</p>
% endif
% if ('top' in data['images']) and ('attribution' in data['images']['top']):
<p class="photoauthor center">
${data['images']['top']['attribution']}
</p>
% endif
</aside>
% endif
% if 'hr' not in data['exclude']:
<hr/>
% endif
% endif
${data['content']}
% if 'article' not in data['exclude']:
</article>
% endif
% if 'footer' not in data['exclude']:
<nav>
% if 'footerHR' not in data['exclude']:
<hr/>
% endif
<p class="footer">
<a href="../">find more by Matthew Davis</a>
</p>
</nav>
% endif
% if 'appear' not in data['exclude']:
</div>
% endif
<iframe
% if stage == 'prod':
src="https://5lvllysysx4j74irbzzfybotbe0dgffh.lambda-url.ap-southeast-2.on.aws/increment?page_name=${data['sourcePath']}"
% else:
src="https://swsz5v2c5ged3q3xsaan5kpfgq0slqkn.lambda-url.ap-southeast-2.on.aws/increment?page_name=${data['sourcePath']}"
% endif
class="metrics"
sandbox
style="display: none;visibility: hidden;height: 0;width: 0;border: none;overflow: hidden;">
</iframe>
</body>
</html>