pub mod slug; use topcoat::{ Result, context::Cx, router::{href, page}, view::{View, component, view}, }; use crate::{app::Title, content::posts::Post}; pub fn detail_url(cx: &Cx, post: Post) -> String { href!(slug::detail, slug: post.slug()).resolve(cx) } #[component] pub async fn post_row(cx: &Cx, post: Post) -> Result { Ok(view! { (post.date().unwrap_or(post.kind().label())) (post.title()) }) } #[page(with(Title(|_| "Posts ยท tahinli".to_owned())))] pub async fn index(cx: &Cx) -> Result { Ok(view! {

"Writing"

for post in Post::ALL { post_row(post: post) } }) }