Skip to content

Serve favicon assets from the site root#35

Merged
ericmj merged 1 commit into
mainfrom
favicon-served-from-root
Jun 8, 2026
Merged

Serve favicon assets from the site root#35
ericmj merged 1 commit into
mainfrom
favicon-served-from-root

Conversation

@ericmj

@ericmj ericmj commented Jun 8, 2026

Copy link
Copy Markdown
Member

The favicon set lived under /favicon/, but the hexdocs compute service treats the apex //... namespace as package doc redirects. /favicon/favicon.svg was therefore 301-redirected to favicon.hexdocs.pm and bounced back, instead of being served directly.

Move the assets to the root and reference them there. Root filenames such as favicon.svg, site.webmanifest and apple-touch-icon.png contain a '.' or '-' right after the leading name token, so they don't match the package-redirect pattern and are served directly without any reserved-name handling.

Also point the 404 page at the favicon set instead of the nonexistent /favicon.png.

The favicon set and the logo lived under /favicon/ and /images/, but the
hexdocs compute service treats the apex /<name>/... namespace as package doc
redirects. Requests like /favicon/favicon.svg and /images/hexdocs-logo.svg were
301-redirected to <name>.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.
@ericmj ericmj merged commit 2ba6879 into main Jun 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant