favicon templates DevOps Developer System Administrator

Can I add a custom favicon for documents?

Question

We want to use a custom favicon for documents? Can we configure Jahia to generate a favicon for the pages and the documents?

Answer

On a page, the easiest way is to add such a line in your template file:

<link rel="shortcut icon" href="/path/to/favicon.ico" type="image/x-icon">

You can also add such code in any component if you don't have access to your main template JSP file

<template:addResources type="inline" targetTag="head">
    <link rel="shortcut icon" href="${url.currentModule}/images/favicon/favicon.ico" type="image/x-icon">
</template:addResources>        

Note that using this path ${url.currentModule}/images/favicon/favicon.ico will load the file images/favicon/favicon.ico in the module that provide the JSP

You can generate a favicon from any JPG file using such external tool https://www.favicon-generator.org

For other document types (non HTML files), you need to put your  http://example.com/favicon.ico at the root of your site in the tomcat/webapps/ROOT directory.