You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB
Rust

use axum::extract::Extension;
use maud::html;
use crate::{
posts_store::ConcurrentPostsStore,
template,
};
use super::response::HtmlResponse;
pub async fn handle(Extension(posts): Extension<ConcurrentPostsStore>) -> HtmlResponse {
HtmlResponse::new()
.with_title_static("Articles")
.with_crawler_permissive()
.with_head(html! {
link href="/static/styles/main.css" rel="stylesheet";
})
.with_body(template::main_page(html! {
section .content_section {
h1 { "Articles" }
p {
"A collection of words I have written, against my better judgement."
}
ul {
@for post in posts.read().await.iter_by_created().rev() {
li {
a href={"/articles/" (post.id_str())} { (post.title()) }
span class="quiet" {
" — " (post.created().format("%Y/%m/%d"))
}
}
}
}
}
}))
}