diff options
| author | Xe <me@christine.website> | 2022-08-04 18:58:09 +0000 |
|---|---|---|
| committer | Xe <me@christine.website> | 2022-08-04 18:58:09 +0000 |
| commit | 5a50cacef85c9e3b9695a2749359b27d0530f86a (patch) | |
| tree | 398dba6f8364d11b6e1ca8221ec5faca9b352e3c /src | |
| parent | d3fd411ffc3a14c40932ce585c48d07541c9fee9 (diff) | |
| download | xesite-5a50cacef85c9e3b9695a2749359b27d0530f86a.tar.xz xesite-5a50cacef85c9e3b9695a2749359b27d0530f86a.zip | |
Do I need Kubernetes?
Signed-off-by: Xe <me@christine.website>
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/markdown.rs | 2 | ||||
| -rw-r--r-- | src/tmpl/mod.rs | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/app/markdown.rs b/src/app/markdown.rs index dee4eef..e539234 100644 --- a/src/app/markdown.rs +++ b/src/app/markdown.rs @@ -100,7 +100,7 @@ pub fn render(cfg: Arc<Config>, inp: &str) -> Result<String> { }), element!("xeblog-hero", |el| { let file = el.get_attribute("file").expect("wanted xeblog-hero to contain file"); - el.replace(&crate::tmpl::xeblog_hero(file, el.get_attribute("prompt")).0, ContentType::Html); + el.replace(&crate::tmpl::xeblog_hero(file, el.get_attribute("prompt"), el.get_attribute("ai")).0, ContentType::Html); Ok(()) }), element!("xeblog-salary-history", |el| { diff --git a/src/tmpl/mod.rs b/src/tmpl/mod.rs index bbb0a98..d919c92 100644 --- a/src/tmpl/mod.rs +++ b/src/tmpl/mod.rs @@ -22,15 +22,21 @@ pub fn xeblog_salary_history(cfg: Arc<Config>) -> Markup { } } -pub fn xeblog_hero(file: String, prompt: Option<String>) -> Markup { +pub fn xeblog_hero(file: String, prompt: Option<String>, ai: Option<String>) -> Markup { + let ai = ai.unwrap_or("MidJourney".to_string()); html! { + meta property="og:image" content={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) "-smol.png"} 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) } } + figcaption { + "Image generated by " + (ai) + @if let Some(prompt) = prompt { " -- " (prompt) } + } } } } |
