aboutsummaryrefslogtreecommitdiff
path: root/src/tmpl/mod.rs
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2022-06-08 14:58:29 -0400
committerXe Iaso <me@christine.website>2022-06-08 15:02:52 -0400
commitdc3f6471e774eaafab92dfcd73dd089707646469 (patch)
tree3b69a8d6f1f05b6c59086f14ae0cbef9ae248a24 /src/tmpl/mod.rs
parent396150f72bcd4545864d96f50afbf39cb6c15afb (diff)
downloadxesite-dc3f6471e774eaafab92dfcd73dd089707646469.tar.xz
xesite-dc3f6471e774eaafab92dfcd73dd089707646469.zip
Add hero image support with <xeblog-hero>
Also lightens the JavaScript load and shifts ad impressions to only when people from Reddit and Hacker News visit. I may have this include Twitter in the future. Signed-off-by: Xe <me@christine.website>
Diffstat (limited to 'src/tmpl/mod.rs')
-rw-r--r--src/tmpl/mod.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/tmpl/mod.rs b/src/tmpl/mod.rs
new file mode 100644
index 0000000..29d75f6
--- /dev/null
+++ b/src/tmpl/mod.rs
@@ -0,0 +1,38 @@
+use maud::{html, Markup};
+
+pub mod nag;
+
+pub fn xeblog_hero(file: String, prompt: Option<String>) -> Markup {
+ html! {
+ figure.hero style="margin:0" {
+ picture style="margin:0" {
+ source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) ".avif"};
+ source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) ".webp"};
+ img style="padding:0" alt={"hero image " (file)} src={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) "-smol.png"};
+ }
+ figcaption { "Image generated by MidJourney" @if let Some(prompt) = prompt { " -- " (prompt) } }
+ }
+ }
+}
+
+pub fn xeblog_conv(name: String, mood: String, body: Markup) -> Markup {
+ let name_lower = name.clone().to_lowercase();
+
+ html! {
+ .conversation {
+ ."conversation-picture"."conversation-smol" {
+ picture {
+ source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".avif"};
+ source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".webp"};
+ img alt={(name) " is " (mood)} src={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".png"};
+ }
+ }
+ ."conversation-chat" {
+ "<"
+ b { (name) }
+ "> "
+ (body)
+ }
+ }
+ }
+}