From 7c17674a14ad617cfbe09de54185c8a070e90570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Mon, 8 Jun 2026 18:23:25 +0200 Subject: [PATCH] Serve favicon and logo assets under /assets/ The favicon set and the logo lived under /favicon/ and /images/, but the hexdocs compute service treats the apex //... namespace as package doc redirects. Requests like /favicon/favicon.svg and /images/hexdocs-logo.svg were 301-redirected to .hexdocs.pm and bounced back instead of being served directly. Serve them under /assets/ instead, which the compute service reserves so the prefix is served straight from the bucket with no redirect. favicon.ico stays at the root since browsers request it there implicitly. Also point the 404 page at the favicon set instead of the nonexistent /favicon.png. --- assets/404.html | 3 ++- assets/{favicon => assets}/apple-touch-icon.png | Bin assets/{favicon => assets}/favicon-96x96.png | Bin assets/{favicon => assets}/favicon.svg | 0 assets/{images => assets}/hexdocs-logo.svg | 0 assets/{favicon => assets}/site.webmanifest | 4 ++-- .../web-app-manifest-192x192.png | Bin .../web-app-manifest-512x512.png | Bin gleam.toml | 8 ++++---- src/hexdocs/view/home.gleam | 2 +- src/hexdocs/view/search.gleam | 2 +- 11 files changed, 10 insertions(+), 9 deletions(-) rename assets/{favicon => assets}/apple-touch-icon.png (100%) rename assets/{favicon => assets}/favicon-96x96.png (100%) rename assets/{favicon => assets}/favicon.svg (100%) rename assets/{images => assets}/hexdocs-logo.svg (100%) rename assets/{favicon => assets}/site.webmanifest (76%) rename assets/{favicon => assets}/web-app-manifest-192x192.png (100%) rename assets/{favicon => assets}/web-app-manifest-512x512.png (100%) diff --git a/assets/404.html b/assets/404.html index 5c88b71..07e02c9 100644 --- a/assets/404.html +++ b/assets/404.html @@ -95,7 +95,8 @@ } } - + + diff --git a/assets/favicon/apple-touch-icon.png b/assets/assets/apple-touch-icon.png similarity index 100% rename from assets/favicon/apple-touch-icon.png rename to assets/assets/apple-touch-icon.png diff --git a/assets/favicon/favicon-96x96.png b/assets/assets/favicon-96x96.png similarity index 100% rename from assets/favicon/favicon-96x96.png rename to assets/assets/favicon-96x96.png diff --git a/assets/favicon/favicon.svg b/assets/assets/favicon.svg similarity index 100% rename from assets/favicon/favicon.svg rename to assets/assets/favicon.svg diff --git a/assets/images/hexdocs-logo.svg b/assets/assets/hexdocs-logo.svg similarity index 100% rename from assets/images/hexdocs-logo.svg rename to assets/assets/hexdocs-logo.svg diff --git a/assets/favicon/site.webmanifest b/assets/assets/site.webmanifest similarity index 76% rename from assets/favicon/site.webmanifest rename to assets/assets/site.webmanifest index 93ecebf..a595ec5 100644 --- a/assets/favicon/site.webmanifest +++ b/assets/assets/site.webmanifest @@ -3,13 +3,13 @@ "short_name": "Hexdocs", "icons": [ { - "src": "/favicon/web-app-manifest-192x192.png", + "src": "/assets/web-app-manifest-192x192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable" }, { - "src": "/favicon/web-app-manifest-512x512.png", + "src": "/assets/web-app-manifest-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" diff --git a/assets/favicon/web-app-manifest-192x192.png b/assets/assets/web-app-manifest-192x192.png similarity index 100% rename from assets/favicon/web-app-manifest-192x192.png rename to assets/assets/web-app-manifest-192x192.png diff --git a/assets/favicon/web-app-manifest-512x512.png b/assets/assets/web-app-manifest-512x512.png similarity index 100% rename from assets/favicon/web-app-manifest-512x512.png rename to assets/assets/web-app-manifest-512x512.png diff --git a/gleam.toml b/gleam.toml index 588ce67..d4a4bc0 100644 --- a/gleam.toml +++ b/gleam.toml @@ -35,14 +35,14 @@ stylesheets = [ [[tools.lustre.html.links]] rel = "icon" -href = "/favicon/favicon-96x96.png" +href = "/assets/favicon-96x96.png" sizes="96x96" type = "image/png" [[tools.lustre.html.links]] rel = "icon" type = "image/svg+xml" -href = "/favicon/favicon.svg" +href = "/assets/favicon.svg" [[tools.lustre.html.links]] rel = "shortcut icon" @@ -51,11 +51,11 @@ href = "/favicon.ico" [[tools.lustre.html.links]] rel = "apple-touch-icon" sizes = "180x180" -href = "/favicon/apple-touch-icon.png" +href = "/assets/apple-touch-icon.png" [[tools.lustre.html.links]] rel = "manifest" -href = "/favicon/site.webmanifest" +href = "/assets/site.webmanifest" [[tools.lustre.html.scripts]] async = true diff --git a/src/hexdocs/view/home.gleam b/src/hexdocs/view/home.gleam index 8d2dcaa..a08f016 100644 --- a/src/hexdocs/view/home.gleam +++ b/src/hexdocs/view/home.gleam @@ -47,7 +47,7 @@ pub fn home(model: Model) { [id("logo"), class("flex align-middle justify-start gap-3")], [ html.img([ - attribute.src("/images/hexdocs-logo.svg"), + attribute.src("/assets/hexdocs-logo.svg"), attribute.alt("HexDocs Logo"), class("w-auto h-10 lg:h-12"), ]), diff --git a/src/hexdocs/view/search.gleam b/src/hexdocs/view/search.gleam index 847ac6c..b1c9c4c 100644 --- a/src/hexdocs/view/search.gleam +++ b/src/hexdocs/view/search.gleam @@ -470,7 +470,7 @@ fn hexdocs_logo() { html.img([ class("w-auto h-6"), attribute.alt("HexDocs Logo"), - attribute.src("/images/hexdocs-logo.svg"), + attribute.src("/assets/hexdocs-logo.svg"), ]), html.div([class("flex items-center")], [ html.span(