Skip to content

Support multiple favicons - #35

Open
deberlhe-jb wants to merge 4 commits into
brokenhandsio:mainfrom
deberlhe-jb:feat/support-multiple-favicons
Open

deberlhe-jb wants to merge 4 commits into
brokenhandsio:mainfrom
deberlhe-jb:feat/support-multiple-favicons

Conversation

@deberlhe-jb

Copy link
Copy Markdown
Contributor

All browsers handle different favicon formats and dimensions.

While modern browsers can handle SVG fine, older ones rely on PNG files with different sizes, or ICO files.

Kiln only support one favicon, so setting a nice SVG icon will prevent some browsers to display it.

With this Pull Request, it will be possible to add different icons to use the most efficient one at highest resolution when possible, with fallbacks otherwise.

This also allows adding an apple-touch-icon.

@0xTim : This is a proposition, but it introduces a breaking change in the Theme configuration API, as I replaced favicon: String with favicons: [FavIcon]. We can discuss changes to make or instructions to write for migration if needed.

@0xTim 0xTim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I think this is a good idea, but I want to avoid breaking the API for now. Could we add this as a new API and deprecate the old one? We can deprecate the favicon property and turn it just compute it based off the first item from the array. That should give us a clean migration

@deberlhe-jb
deberlhe-jb force-pushed the feat/support-multiple-favicons branch from cf2c81f to 10920ae Compare September 9, 2026 17:55
@deberlhe-jb
deberlhe-jb force-pushed the feat/support-multiple-favicons branch from 10920ae to 9d7fcf9 Compare September 9, 2026 20:49
@deberlhe-jb
deberlhe-jb marked this pull request as draft September 9, 2026 20:51
@deberlhe-jb
deberlhe-jb marked this pull request as ready for review September 9, 2026 21:02
@deberlhe-jb
deberlhe-jb requested a review from 0xTim September 9, 2026 21:02
@deberlhe-jb

Copy link
Copy Markdown
Contributor Author

@0xTim if think these changes are working, let me know what you think !

@0xTim 0xTim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I think we're there almost. The last thing I would like to add is disfavoured overload annotations to the old APIs since they both have default arguments to ensure the compiler picks the right one

Comment thread Sources/Kiln/Configuration/KilnSite.swift Outdated
self.path = path ?? type.defaultPath()
}

@available(*, deprecated, message: "This initializer guesses the type from a string and is therefore not as reliable as init(type:path:).")

@deberlhe-jb deberlhe-jb Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xTim I'm not sure wether I should add the @_disfavoredOverload annotation here since it would pick SVG as the default format instead of guessing a possibly more appropriate one. What do you think ?

@deberlhe-jb
deberlhe-jb requested a review from 0xTim September 25, 2026 09:01
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.

2 participants