Skip to content

Melody Cookbook: Assign a favicon to your site.

mikert edited this page Feb 27, 2011 · 1 revision

Letting your users define their favicon is as simple as defining a configuration option whose type is "file."

favicon:
    type: file
    label: 'Site Favicon'
    hint: 'This will control the favicon used by this site.'
    tag: Favicon

Wherever you specify your header tags, this is enough to expose that functionality:

<mt:FaviconAsset>
<link rel="icon" 
    type="image/<$mt:AssetFileExt$>" 
    href="<$mt:AssetURL$>">
</mt:FaviconAsset>

ConfigAssistant exposes two template tags for "Favicon:"

  1. <mt:Favicon>
  2. <mt:FaviconAsset>

The first one is a function tag that returns the asset id number from the database for the favicon image. The second is a block tag which exposes an asset context where asset function tags can be used.

That's it. With those simple tricks, your template will now have a customizable favicon that complies with W3C standards.

Clone this wiki locally