aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / crates / site-builder / src / components / footer.rs
| 1 | use maud::{html, Markup, PreEscaped}; |
| 2 | |
| 3 | /// One footer link: (label, href). |
| 4 | pub type FooterLink = (&'static str, &'static str); |
| 5 | |
| 6 | /// The whole footer menu. The six sections already sit in the header, and |
| 7 | /// every other page is one click away in the site map, so the footer keeps |
| 8 | /// only the few routes a reader looks for at the bottom of a page. |
| 9 | pub const FOOTER_LINKS: [FooterLink; 8] = [ |
| 10 | ("Start here", "/start/"), |
| 11 | ("Evidence", "/evidence/"), |
| 12 | ("Blog", "/blog"), |
| 13 | ("Contact", "/contact/"), |
| 14 | ("Privacy", "/privacy/"), |
| 15 | ("Glossary", "/glossary/"), |
| 16 | ("Site map", "/sitemap.md"), |
| 17 | ("About the engineer", "/engineer/"), |
| 18 | ]; |
| 19 | |
| 20 | pub fn render_footer() -> Markup { |
| 21 | html! { |
| 22 | footer class="aien-footer" { |
| 23 | div class="container" { |
| 24 | div class="aien-footer-row" { |
| 25 | a class="aien-footer-brand" href="/" { |
| 26 | (PreEscaped(r#"<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--accent-blue)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>"#)) |
| 27 | span { "AienOS" } |
| 28 | } |
| 29 | nav class="aien-footer-links" aria-label="Footer" { |
| 30 | ul { |
| 31 | @for (label, href) in FOOTER_LINKS { |
| 32 | li { a href=(href) { (label) } } |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | div class="aien-footer-legal" { |
| 38 | (crate::components::contact::footer_reach()) |
| 39 | p { |
| 40 | "Aien © 2026 · " |
| 41 | a href="/licensing/" { "Licensing" } |
| 42 | " · No trackers unless you say hello to Aien." |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | #[cfg(test)] |
| 51 | mod tests { |
| 52 | use super::*; |
| 53 | |
| 54 | #[test] |
| 55 | fn footer_stays_short() { |
| 56 | let html = render_footer().into_string(); |
| 57 | assert!(FOOTER_LINKS.len() <= 8, "the footer menu is a handful of links, not a site map"); |
| 58 | assert!(!html.contains("<h2"), "the footer carries no headed link columns"); |
| 59 | for (_, href) in FOOTER_LINKS { |
| 60 | assert!(html.contains(&format!("href=\"{href}\"")), "footer lacks {href}"); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | #[test] |
| 65 | fn footer_reaches_drake() { |
| 66 | let html = render_footer().into_string(); |
| 67 | for needle in ["href=\"https://x.com/drakestapleton\"", "href=\"mailto:drake@aienos.com\"", "href=\"/contact/\"", "href=\"/privacy/\"", "href=\"/sitemap.md\""] { |
| 68 | assert!(html.contains(needle), "footer lacks {needle}"); |
| 69 | } |
| 70 | assert!(html.contains(&format!("href=\"{}\"", crate::components::contact::ALLEN)), "footer lacks the Aien route"); |
| 71 | } |
| 72 | |
| 73 | #[test] |
| 74 | fn footer_has_no_em_or_en_dash() { |
| 75 | let html = render_footer().into_string(); |
| 76 | assert!(!html.contains('\u{2014}') && !html.contains('\u{2013}')); |
| 77 | } |
| 78 | } |