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
|
use super::{base, nag};
use crate::post::{schemaorg::Article, Post};
use maud::{html, Markup, PreEscaped};
use xesite_templates::xeact_component;
fn post_metadata(post: &Post) -> Markup {
let art: Article = post.into();
let json = PreEscaped(serde_json::to_string(&art).unwrap());
html! {
meta name="twitter:card" content="summary";
meta name="twitter:site" content="@theprincessxena";
meta name="twitter:title" content={(post.front_matter.title)};
meta property="og:type" content="website";
meta property="og:title" content={(post.front_matter.title)};
meta property="og:site_name" content="Xe's Blog";
meta name="description" content={(post.front_matter.title) " - Xe's Blog"};
meta name="author" content="Xe Iaso";
@if let Some(redirect_to) = &post.front_matter.redirect_to {
link rel="canonical" href=(redirect_to);
meta http-equiv="refresh" content=(format!("0;URL='{redirect_to}'"));
} @else {
link rel="canonical" href={"https://xeiaso.net/" (post.link)};
}
script type="application/ld+json" {(json)}
}
}
fn share_button(post: &Post) -> Markup {
return xeact_component("MastodonShareButton", serde_json::json!({
"title": post.front_matter.title,
"series": post.front_matter.series,
"tags": post.front_matter.tags.as_ref().unwrap_or(&Vec::new())
}));
}
fn twitch_vod(post: &Post) -> Markup {
html! {
@if let Some(vod) = &post.front_matter.vod {
p {
"This post was written live on "
a href="https://www.twitch.tv/princessxen" {"Twitch"}
". You can check out the stream recording on "
a href=(vod.twitch) {"Twitch"}
" and on "
a href=(vod.youtube) {"YouTube"}
". If you are reading this in the first day or so of this post being published, you will need to watch it on Twitch."
}
}
}
}
pub fn blog(post: &Post, body: PreEscaped<&String>, referer: Option<String>) -> Markup {
base(
Some(&post.front_matter.title),
None,
html! {
(post_metadata(post))
@if !post.front_matter.skip_ads {
(nag::referer(post, referer))
}
article {
h1 {(post.front_matter.title)}
(nag::prerelease(post))
small {
"Read time in minutes: "
(post.read_time_estimate_minutes)
}
div {
(body)
}
}
hr;
(share_button(post))
(twitch_vod(post))
p {
"This article was posted on "
(post.detri())
". Facts and circumstances may have changed since publication. Please "
a href="/contact" {"contact me"}
" before jumping to conclusions if something seems wrong or unclear."
}
@if let Some(series) = &post.front_matter.series {
p {
"Series: "
a href={"/blog/series/" (series)} {(series)}
}
}
@if let Some(tags) = &post.front_matter.tags {
p {
"Tags: "
@for tag in tags {
code {(tag)}
" "
}
}
}
@if post.mentions.is_empty() {
p {
"This post was not "
a href="https://www.w3.org/TR/webmention/" {"WebMention"}
"ed yet. You could be the first!"
}
} @else {
ul {
@for mention in &post.mentions {
li {
a href=(mention.source) {(mention.title.as_ref().unwrap_or(&mention.source))}
}
}
}
}
p {
"The art for Mara was drawn by "
a href="https://selic.re/" {"Selicre"}
"."
}
p {
"The art for Cadey was drawn by "
a href="https://artzorastudios.weebly.com/" {"ArtZora Studios"}
"."
}
p {
"Some of the art for Aoi was drawn by "
a href="https://twitter.com/Sandra_Thomas01" {"@Sandra_Thomas01"}
"."
}
},
)
}
pub fn gallery(post: &Post) -> Markup {
base(
Some(&post.front_matter.title),
None,
html! {
(post_metadata(post))
h1 {(post.front_matter.title)}
(PreEscaped(&post.body_html))
center {
img src=(post.front_matter.image.as_ref().unwrap());
}
hr;
p {
"This artwork was posted on "
(post.detri())
"."
}
@if let Some(tags) = &post.front_matter.tags {
p {
"Tags: "
@for tag in tags {
code {(tag)}
" "
}
}
}
(share_button(post))
},
)
}
pub fn talk(post: &Post, body: PreEscaped<&String>, referer: Option<String>) -> Markup {
base(
Some(&post.front_matter.title),
None,
html! {
(post_metadata(post))
@if !post.front_matter.skip_ads {
(nag::referer(post, referer))
}
article {
h1 {(post.front_matter.title)}
(nag::prerelease(post))
(body)
}
@if let Some(slides) = &post.front_matter.slides_link {
a href=(slides) {"Link to the slides"}
}
hr;
(share_button(post))
p {
"This talk was posted on "
(post.detri())
". Facts and circumstances may have changed since publication Please "
a href="/contact" {"contact me"}
" before jumping to conclusions if something seems wrong or unclear."
}
p {
"The art for Mara was drawn by "
a href="https://selic.re/" {"Selicre"}
"."
}
p {
"The art for Cadey was drawn by "
a href="https://artzorastudios.weebly.com/" {"ArtZora Studios"}
"."
}
p {
"Some of the art for Aoi was drawn by "
a href="https://twitter.com/Sandra_Thomas01" {"@Sandra_Thomas01"}
"."
}
},
)
}
|