more images!
All checks were successful
Build / build (push) Successful in 4s

This commit is contained in:
2026-01-31 21:40:17 -05:00
parent ce0edf6060
commit fb23b004ce
3 changed files with 13 additions and 5 deletions

View File

@@ -34,20 +34,21 @@ fn load_posts() -> Result<HashMap<String, Post>, Error> {
let summary = re_summary.captures(&typst)
.expect("Post summary not found")
.get(1).unwrap().as_str().trim().to_string();
let img_path = dir?.path().join(
let img_path = "/".to_string() + dir?.path().join(
re_img.captures(&typst)
.expect("Post preview image not found")
.get(1).unwrap().as_str().trim().to_string()
).to_str().expect("Failed converting path to string").to_string();
).to_str().expect("Failed converting path to string");
posts.insert(
slug.clone(),
Post {
slug: slug,
title: title,
preview_image: img_path,
preview_image: img_path.clone(),
summary: summary,
render: Html(PostTemplate {
content: typst_to_html(typst),
image: img_path
}.render().expect("Failed rendering post")),
}
);
@@ -58,6 +59,7 @@ fn load_posts() -> Result<HashMap<String, Post>, Error> {
#[derive(Template)]
#[template(path = "post.html")]
struct PostTemplate {
image: String,
content: String,
}
@@ -67,8 +69,8 @@ struct Post {
title: String,
preview_image: String,
summary: String,
slug: String,
render: Html<String>
render: Html<String>,
slug: String
}

View File

@@ -123,6 +123,11 @@ a {
text-align: left;
}
.top-image {
max-height: 40vh;
max-width: 1000px;
}
nav ul {
list-style: none;
display: flex;

View File

@@ -3,6 +3,7 @@
{% block body %}
<div class="post">
<img src="{{ image }}" class="top-image">
{{ content|safe }}
</div>