From 31e8fed49f64e3438a4690b9c6b39a0a3e4c5111 Mon Sep 17 00:00:00 2001 From: gl0w Date: Thu, 10 Sep 2026 06:50:13 +0100 Subject: [PATCH] m6/favicon: icons, head standards, manifest + mime (127 tests) --- src/build.rs | 15 ++ src/layout.rs | 34 ++++- src/serve.rs | 10 ++ static/favicon.svg | 8 + static/manifest.webmanifest | 1 + tests/favicon.rs | 289 ++++++++++++++++++++++++++++++++++++ 6 files changed, 356 insertions(+), 1 deletion(-) create mode 100644 static/favicon.svg create mode 100644 static/manifest.webmanifest create mode 100644 tests/favicon.rs diff --git a/src/build.rs b/src/build.rs index d743377..7eb9b0d 100644 --- a/src/build.rs +++ b/src/build.rs @@ -222,6 +222,20 @@ fn write_style(out: &Path) -> Result<(), String> { std::fs::write(out.join("style.css"), css).map_err(|e| format!("hu13: write style.css: {e}")) } +/// Write `out/favicon.svg` + `out/manifest.webmanifest` from the embedded +/// static files (m6 favicon, f0rge issue #16). SVG-first, zero binary +/// blobs: the favicon is the hand-written logo mark, and the manifest +/// points at it (`icons` svg, `short_name` hu13, `display` minimal-ui). +fn write_favicon_and_manifest(out: &Path) -> Result<(), String> { + let icon = include_str!("../static/favicon.svg"); + std::fs::write(out.join("favicon.svg"), icon) + .map_err(|e| format!("hu13: write favicon.svg: {e}"))?; + let manifest = include_str!("../static/manifest.webmanifest"); + std::fs::write(out.join("manifest.webmanifest"), manifest) + .map_err(|e| format!("hu13: write manifest.webmanifest: {e}"))?; + Ok(()) +} + /// Build the full static site. Returns a summary on success. pub fn run_build(repo: &Path, out: &Path, opts: &BuildOptions) -> Result { let branch = gitx::resolve_branch(repo, opts.branch_flag.as_deref()) @@ -264,6 +278,7 @@ pub fn run_build(repo: &Path, out: &Path, opts: &BuildOptions) -> Result String { /// and `og:description` / `meta[name=description]` carry `description` /// when present. `site_name` and `description` are escaped (hostile /// `