commit 90cc39591db199ae47e600bd2a37d492e5df6b39 from: Benjamin Stürz date: Thu May 02 02:15:29 2024 UTC add link to Code commit - 9c7a58633661bd586f5d1ce09e521482fe4acba0 commit + 90cc39591db199ae47e600bd2a37d492e5df6b39 blob - 0c84777685acf7ca9bf0482222b0246dd97ce5f0 blob + b2a5ef999c0586591c620302043e6176dcdc58c5 --- src/site/mod.rs +++ src/site/mod.rs @@ -1,3 +1,5 @@ +use std::iter::once; + use itertools::Itertools; use crate::{Result, Page, Request, html, html::Element}; @@ -80,6 +82,7 @@ pub fn route(req: &Request) -> Result { #[allow(unstable_name_collisions)] pub fn menu() -> Element { + let code = ("Code", "https://got.stuerz.xyz/?action=summary&path=www-cgi.git".into()); html! { nav { [ @@ -88,10 +91,12 @@ pub fn menu() -> Element { .filter_map(|r| r.label.as_ref().map(|l| (l, r.prefix))) .map(|((l, w), p)| (l, w, p)) .sorted_by(|(_, w1, _), (_, w2, _)| w1.cmp(w2)) - .map(|(l, _, p)| { - let p = p.strip_suffix('*').unwrap_or(p); + .map(|(l, _, p)| (*l, format!("/test/{p}"))) + .chain(once(code)) + .map(|(l, p)| { + let p = p.strip_suffix('*').unwrap_or(&p); html! { - a [href=format!("/test{p}")] { {*l} } + a [href=p] { {l} } } }) .intersperse(" | ".into())