1# Pagesicon 2 3I really like DokuWiki, but I always found it a bit sad: there was no simple way to add nice icons to pages. 4With **pagesicon**, this is now possible. 5 6The plugin can: 7- display an icon at the top of the page (`show`); 8- use this icon as the browser tab favicon (`show_as_favicon`); 9- display an icon before internal wiki links; 10- provide an icon management page with `?do=pagesicon`; 11- handle `big` and `small` variants depending on the context; 12- expose a helper (reusable API) for other plugins. 13 14## Usage 15 16From a page, use the `Manage icon` action to: 17- upload a `big` icon; 18- upload a `small` icon; 19- delete the current icon. 20 21## Configuration 22 23In the configuration manager: 24- `icon_name`: candidate filenames for the `big` icon, separated by `;`, with support for `~pagename~` 25- `icon_thumbnail_name`: candidate filenames for the `small` icon, separated by `;`, with support for `~pagename~` 26- `default_image`: default image used only when a helper method explicitly asks for a fallback 27- `icon_size`: size of the icon displayed at the top of the page 28- `extensions`: allowed extensions, for example `svg;png;jpg;jpeg` 29- `show_on_top`: displays the icon in the page 30- `show_as_favicon`: uses the icon as favicon 31- `parent_fallback`: allows using a parent icon when the page has none 32- `link_icons`: displays an icon before internal links (`none` / `existing` / `all`) 33 34## What the helper provides 35 36Load helper: 37 38```php 39$pagesicon = plugin_load('helper', 'pagesicon'); 40``` 41 42Main methods: 43 44- `getPageIconId()`: returns the media ID of a page icon 45- `getMediaIconId()`: returns the media ID of the icon associated with a media file 46- `getPageIconUrl()`: returns the versioned URL of a page icon 47- `getMediaIconUrl()`: returns the versioned URL of the icon associated with a media file 48- `getDefaultIconUrl()`: returns the URL of the default image to use when no icon is found 49- `getUploadIconPage()`: returns the icon management URL for a page 50- `getUploadMediaIconPage()`: returns the icon management URL for a media file 51- `notifyIconUpdated()`: notifies other plugins that an icon changed 52 53## Cache and integrations 54 55When an icon is modified, the plugin triggers the `PLUGIN_PAGESICON_UPDATED` event. 56 57This allows other plugins to refresh or invalidate their own cache when needed. 58 59## Icon inheritance 60 61If no icon is found on the page itself, the plugin can also: 62- inherit no icon; 63- use the direct parent icon; 64- use the first icon found while walking up parent namespaces. 65