forge
Explore
Log in

Don't you dare go Hollow

personality

Clone
★ 0

0 watching0 forksRustGPL-3.0460.1 KiB4de8815Tahinli7 days ago22 commits

slug.rs35 lines, 932 bytesHistoryRawDownload
1use topcoat::{
2 Result,
3 context::Cx,
4 router::{error::RouterErrorExt, href, module_param, page},
5 view::{View, view},
6};
7
8use crate::{
9 app::{Title, blocks::blocks},
10 content::projects::Project,
11};
12
13module_param!(pub slug);
14
15fn title(cx: &Cx) -> String {
16 match Project::from_slug(slug(cx)) {
17 Some(project) => format!("{} · tahinli", project.name()),
18 None => String::from("tahinli"),
19 }
20}
21
22#[page(with(Title(title)))]
23pub async fn detail(cx: &Cx) -> Result<impl View> {
24 let project = Project::from_slug(slug(cx)).ok_or_not_found()?;
25
26 Ok(view! {
27 <article class="article">
28 <a class="back" href=(href!(super::index))>"← projects"</a>
29 <h1>(project.name())</h1>
30 <p class="lead">(project.summary())</p>
31 <a class="more" href=(project.source())>"source ↗"</a>
32 blocks(items: project.body())
33 </article>
34 })
35}