use super::blog::POSTS; pub fn module(router: &mut windmark::router::Router) { crate::route::track_mount( router, "/", "This Gemini capsule's homepage", move |context| { crate::response::success( &format!( r#"# Fuwn[.me] I enjoy writing for archaic systems in dated languages and with artificially imposed constraints, all while aiming for peak performance and minimal design. => https://github.com/Fuwn Projects (GitHub) ## Recent Posts {} ## More I write a lot of software and tooling for the Gemini protocol, the backbone of this site. You can learn more over at GemRest. => https://github.com/gemrest GemRest (GitHub) Don't know where to start? Check out the directory or test your luck! => /directory Directory => /random I'm Feeling Lucky"#, { (*POSTS).lock().map_or_else( |_| "...".to_string(), |global_posts| { let mut posts = global_posts; posts.sort_by(|a, b| b.created_at().cmp(a.created_at())); posts .iter() .map(|post| format!("=> {} {}", post.title(), post.link())) .collect::>() .into_iter() .take(3) .collect::>() .join("\n") }, ) } ), &context, ) }, ); }