Repository navigation
Favicons: discover square size variants and ship a configurable gen-favicons CLI - #2656
Merged
Merged
Conversation
- Contributes to docsy#2357 - Shortens the block comment and points to the user guide for details - Defaults to right-trim whitespace control and indents nested `range`/`if` blocks - Emits explicit newlines between discovered icon links via `{{- "\n" -}}`
- Contributes to docsy#2357 - Generalizes the default partial to discover any square `favicon-NxN.png` in `static/` via `os.ReadDir`, linking the variants in ascending pixel-size order, rather than only the hard-coded 16/32px pair - Collapses the user-guide discovery table to a single `favicon-NxN.png` row and notes that any number of square variants are supported - Adds a theme test asserting arbitrary sizes are linked and numerically sorted - Adds `submatch` to the cspell dictionary for `findRESubmatch`
…rable sizes - Contributes to docsy#2357 - Replaces the `scripts/gen-favicons.sh` wrapper with a Node `scripts/gen-favicons/` folder (index/cli/tests/readme) that runs without bash and shells out to ImageMagick as before. - Adds a `gen-favicons` npm `bin` and ships the tool via `files`, so npm-based Docsy sites run `npx gen-favicons` while module/submodule installs run `cli.mjs` directly. - Supports configurable `--ico`, `--png`, and `--apple` sizes (comma-separated, or `none` to skip), defaulting to the set the favicons partial discovers. - Smoke-tests `npx gen-favicons --help` in NPM mode and pins the new tarball contents in the npm-pack contract test. - Updates the favicons guide, changelog, and spell-check dictionary.
- Contributes to docsy#2357 - Generalizes the default partial to also discover any square `apple-touch-icon-NxN.png` in `static/`, via a reusable inline `sized-variants` helper parameterized by file prefix and link attributes - Coerces the helper's return to `[]interface{}` so the caller's chained `append` always flattens it, avoiding the empty-then-nonempty nesting trap - Adds the `apple-touch-icon-NxN.png` discovery row to the user guide and DRYs the `gen-favicons` guidance to point at `--help` - Adds a theme test asserting square apple-touch-icon variants are linked in ascending pixel-size order
…eholder - Contributes to docsy#2357 - Adds a theme test asserting a non-square `favicon-WxH.png` is ignored while its square sibling is linked, locking the square-only discovery rule - Adds a theme test asserting a sized `apple-touch-icon-NxN.png` is linked on its own when the unsized `apple-touch-icon.png` is absent - Glosses the `PATH_TO_DOCSY` placeholder on first use in the user guide
- Contributes to docsy#2357 - Splits favicon generation into its own "Generate favicons" section, linked from the discovery intro, documenting the npm-package, Git-submodule, and Hugo-module invocations (the latter via `go list -m -f '{{.Dir}}' github.com/google/docsy`) - Uses `static/favicon.svg` as the `gen-favicons` source so the SVG is both linked by the theme and rasterized in place, removing the previous manual "copy your SVG" step - Aligns the `gen-favicons` README and CLI `--help` examples with the same source-in-static usage
chalin
force-pushed
the
chalin-m24-favicons-2026-0615
branch
from
June 15, 2026 14:41
2b7bb50 to
e89ed65
Compare
…icons" - Contributes to docsy#2357 - Makes generation a level-3 subsection so it reads as part of adding favicons rather than a sibling top-level topic; the `#generate-favicons` anchor is unchanged
… pointer - Contributes to docsy#2357 - Adds a theme test asserting unrelated `static/` files (e.g. `robots.txt`, `logo.svg`, `favicon.svg`) are passed over while square `favicon-NxN.png` and `apple-touch-icon-NxN.png` variants are still discovered, pinning the empty-`findRESubmatch` path in the `sized-variants` helper - Rewords the `gen-favicons --help` pointer to the per-install command forms, since `gen-favicons` is only on `PATH` for npm-package installs
chalin
force-pushed
the
chalin-m24-favicons-2026-0615
branch
from
June 15, 2026 15:50
0f8fe3d to
5d1512d
Compare
- Drops `sizes="16x16 32x32 48x48"` from the `favicon.ico` `<link>`: a `.ico` is self-describing (browsers read the frame sizes it bundles), so a declared list adds nothing and silently drifts when the file's frames differ - Documents the rationale (and that SVG-capable browsers prefer `favicon.svg`, with `.ico` as fallback) in a user-guide footnote rather than the template - Updates the theme tests and the favicon golden to expect the size-less `.ico` link
- Fixes the broken `hooks/head-end.html` reference in the favicons user guide: the blob URL was missing the `theme/` path prefix and 404'd - Renames the favicon footnote id `svg-pref` to `ico-link` so it reflects its full content (no `sizes` on `.ico`, plus the SVG preference), not just the SVG aspect - Aligns the `gen-favicons` README to the `DOCSY_DIR` placeholder used in the user guide, and glosses it on first use
- Adds the missing `theme/` path prefix to the partial blob links (`baseof.html`, `head.html`, `scripts.html`, `hooks/head-end.html`, `hooks/body-end.html`), which all 404'd - Points the `scripts.html` link at `scripts.html` instead of `head.html`
11 tasks done
chalin
added a commit
to chalin/docsy
that referenced
this pull request
Jun 26, 2026
…report Release-prep audit reconciliation for 0.16.0: - Reference docsy#2656 (square favicon variant discovery and the configurable gen-favicons CLI) from the favicon entries in the release report and the changelog; it was implemented but previously unreferenced. - Fix a broken "Upgrade to Docsy 0.12.0" link in the rollback NOTE that was split across a stray nested blockquote, and reword so the file is prettier-stable.
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.
favicons.htmlpartial with Hugo template conventions (whitespace trims, structure)favicon-NxN.pngvariant instatic/(was a hard-coded 16/32px pair), in ascending pixel-size order viaos.ReadDirapple-touch-icon-NxN.png, via a reusable inlinesized-variantshelper parameterized by file prefix and link attributes[]interface{}(no-opappend slice) so the caller's chainedappendalways flattens it, avoiding an empty-then-nonempty nesting trapsizes="16x16 32x32 48x48"on thefavicon.icolink: a.icois self-describing, so the declared list adds nothing and silently drifts when the file's frames differ (rationale captured in a user-guide footnote)gen-favicons— npm-installable CLIscripts/gen-favicons.shas a Node CLI folderscripts/gen-favicons/(index/cli/tests/README) exposed via an npmbin(npx gen-favicons)--ico/--png/--applesizes (comma-separated, ornone) with a sensible default setfavicon-NxN.pngandapple-touch-icon-NxN.pngvariants are linked in ascending pixel-size order, agen-faviconstest suite, annpm-packcontract test, and a--helpsmoke test