Articles page
parent
9e86897dcd
commit
d1a7e29f58
@ -0,0 +1,35 @@
|
||||
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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
Loading…
Reference in New Issue