Repository navigation
Discover and link site favicons from the default partial, and add an icon-generation helper - #2654
Merged
chalin merged 3 commits intoJun 14, 2026
Conversation
…icon-generation helper - Contributes to docsy#2357 - Replaces the theme's empty default favicons partial with one that discovers and links the conventionally named favicons a site publishes via `static/` (`favicon.ico`, `favicon.svg`, the 16/32px PNGs, `apple-touch-icon.png`), so most sites need no favicons partial and no config; still ships no icon artwork of its own, honoring docsy#2595 - Uses `relURL` so the emitted hrefs stay correct under a `baseURL` subpath, and `safeHTML` so the `+` in `image/svg+xml` is not escaped to `&docsy#43;` - Converges docsy.dev onto the theme default by dropping its bespoke partial; the golden test confirms byte-identical output - Adds `scripts/gen-favicons.sh` to generate `favicon.ico` and `apple-touch-icon.png` from a source SVG (the formats Hugo cannot produce), with a companion test that skips when ImageMagick is absent - Extends the theme-defaults tests with discovery cases (single file, full set, absent files, `baseURL` subpath) - Rewrites the "Add your favicons" user guide for the zero-partial convention and adds a changelog entry
chalin
force-pushed
the
chalin-m24-favicon-smart-partial-2026-0613
branch
from
June 14, 2026 11:35
e08cfb7 to
7d25877
Compare
- Contributes to docsy#2357 - Clarifies in the user guide that gen-favicons.sh writes only the raster icons, so an SVG favicon must be copied to static/favicon.svg manually - Cross-references the New favicon-discovery entry from the Breaking default-favicons bullet in the changelog - Releads the New changelog entry with the documented "you can now..." past-tense phrasing - Adds a test that locks the optional favicon-16x16.png / favicon-32x32.png discovery rows - Drops a stray "smart" qualifier from a test comment
11 tasks done
- Contributes to docsy#2357 - Asserts the gen-favicons.sh output contract in its test: favicon.ico bundles the 16/32/48px frames and apple-touch-icon.png is 180x180, via magick identify (still skipped when ImageMagick is absent) - Reword the user guide to "covers common browser and platform favicon needs" instead of "practically every browser"
chalin
added a commit
to chalin/docsy-example
that referenced
this pull request
Jun 14, 2026
- Contributes to docsy/docsy#2357 - Adds `favicon.svg`, `favicon.ico`, and `apple-touch-icon.png` under `static/` so the Docsy theme's default favicons partial discovers and links them; the example lost its favicon when docsy/docsy#2653 dropped the theme's bundled defaults - Reuses docsy.dev's favicon assets verbatim -- all three files are byte-identical to docsy.dev's so the example provably uses the same Docsy-logo artwork it already shows in its navbar - Bumps the Docsy theme module to a commit that includes the discovery partial (docsy/docsy#2654) - Adds `tests/favicons.test.mjs` asserting the three discovered `<link>`s render in the built home page
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.
resources.Copy) with a simpler pass-through partial, after research showed Hugo cannot rasterize SVG or emit true.ico, so the most-probed icons (/favicon.ico~49% of probes) can never be generated and must be supplied as files anywayWhat changed:
favicons.htmlwith a default partial that discovers and links the conventionally named favicons a site publishes viastatic/(favicon.ico,favicon.svg,favicon-32x32.png,favicon-16x16.png,apple-touch-icon.png); a site that drops these files instatic/gets the matching<link>tags with no partial and no configrelURLso hrefs stay correct under abaseURLsubpathsafeHTMLso the+inimage/svg+xmlis not escaped to+scripts/gen-favicons.sh, which derivesfavicon.icoandapple-touch-icon.pngfrom a single source SVG via ImageMagick (the formats Hugo cannot produce), with a companion test that skips when ImageMagick is absentbaseURLsubpath)