Serve favicon assets from the site root#35
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.