34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import type { Metadata } from 'next';
|
||
type MediaLike = {
|
||
height?: null | number;
|
||
mimeType?: null | string;
|
||
url?: null | string;
|
||
width?: null | number;
|
||
} | null | undefined;
|
||
/**
|
||
* Builds Next.js `icons` metadata (favicon / apple-touch-icon) from the panel's
|
||
* favicon upload, so the browser tab AND Google get a proper <link rel="icon">.
|
||
*
|
||
* Why the plugin must do this (not the project): favicon-in-Google has strict
|
||
* rules — a real <link rel="icon"> in <head>, square, ≥48×48, at a stable URL.
|
||
* Leaving it to each project meant inconsistent hand-rolled tags and no favicon
|
||
* in search results. This generates the tags correctly, every time, from the
|
||
* panel field.
|
||
*
|
||
* Favicon is GLOBAL (same across pages), so call this once in the ROOT layout's
|
||
* generateMetadata — not per page:
|
||
*
|
||
* import { buildIconsMetadata } from '@intecion/ipal-kit'
|
||
* export async function generateMetadata(): Promise<Metadata> {
|
||
* const settings = await getSettings(locale)
|
||
* return buildIconsMetadata(settings.favicon)
|
||
* }
|
||
*
|
||
* Google notes: it caches favicons separately and slowly (days/weeks), and only
|
||
* shows them for icons it deems valid. Warn on too-small icons at upload time
|
||
* (see the media validation hook) so editors don't ship a <48px favicon Google
|
||
* will reject.
|
||
*/
|
||
export declare function buildIconsMetadata(favicon: MediaLike): Metadata;
|
||
export {};
|