Fav for Craft CMS

Configuration

Per-site settings

Each site has its own icon set, edited at Fav → Icons. These live in the database rather than in project config, deliberately: a favicon is branding, and it gets changed on the live site by whoever owns the brand, without waiting on a deployment.

SettingWhat it does
Source imageThe one image everything is generated from.
Theme colourThe theme-color meta tag, which tints the browser chrome on mobile, and the manifest's theme colour.
Background colourWhat the Apple touch icon is flattened onto, and the manifest's background colour.
Tile colourThe Windows tile's background.
PaddingA margin, 0–40%, around the artwork on the icons that get a background.
Web manifestWhether to write manifest.json and link to it. Turn it off if a PWA plugin owns the manifest.
App name / short nameNames for the manifest. Default to the site name.
EnabledOff keeps the settings and the files but stops the tags.

Why padding only applies to some icons

The small PNG favicons are drawn edge to edge, with no padding. At 16px a margin costs a quarter of the logo, and browser tab strips already leave room around the icon.

The Apple touch icon and the Windows tile are flattened onto a colour. iOS composites a transparent icon onto black, so a dark logo would disappear. These are the icons that get the padding, because without it the logo touches the rounded corners.

The manifest icons (192 and 512) stay transparent. The launcher paints its own background.

Everything is contained, never cropped. A wide logo is shrunk to fit, not sliced to make it square.

The web manifest

Fav's manifest carries the two launcher icons and the two colours, and nothing else. It has no start_url and no display, so it can never make a site installable on its own. That decision belongs to a PWA plugin, not a favicon plugin.

It is written as manifest.json rather than site.webmanifest. Stock Apache and nginx have no MIME mapping for .webmanifest and serve it as application/octet-stream. They serve .json as application/json, which every browser accepts for a manifest.

Already running a PWA plugin? Turn Fav's manifest off for that site. Two <link rel="manifest"> tags is one too many, and the PWA's has to win.

Plugin settings

At Settings → Plugins → Fav, or in config/fav.php:

<?php

return [
    'autoInject' => true,
    'skipPagesWithIcons' => true,
    'serveRootIcon' => true,
    'applyToCp' => false,
    'regenerateOnAssetSave' => true,
    'cacheDuration' => 604800,
];
SettingDefaultWhat it does
autoInjecttrueAdd the tags to front-end HTML pages, just before </head>.
skipPagesWithIconstrueLeave a page alone when its head already links to an icon.
serveRootIcontrueAnswer requests for /favicon.ico at the site root.
applyToCpfalseUse the primary site's icon in the control panel too.
regenerateOnAssetSavetrueRebuild a set when its source image is saved or replaced.
cacheDuration604800Seconds a browser may cache an icon that is served through PHP.