Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to set website favicon in Odoo 9?

By
Lena Razov
on 1/12/16, 6:58 PM 1,235 views

I want to override the website template to be able to use my own favicon on website in Odoo 9.

I have created a custom module website_favicon with the following structure:

__init__.py (empty)

__openerp__.py

views

    - website_templates.xml 

static 

    -  src

        - img 

            favicon.ico 

In  __openerp__.py I put {
    'name': "Website Favicon",
    'version': '1.0.0',
    'author': 'Me',
    'category': 'Custom',
    'description': '''Website Favicon''',
    'depends': ['website'],
    'data': [
        'views/website_templates.xml',
        ],
    'installable': True
}

In website_templates.xml I put

<?xml version="1.0" encoding="utf-8"?>
<openerp>
 <data>
  <template id="website_favicon" inherit_id="website.layout" name="Website Favicon">
         <xpath expr="//meta[@name='keywords']" position="after">
          <link rel="shortcut icon" href="/website_favicon/static/src/img/favicon.ico" type="image/x-icon"/>
         </xpath>
     </template>
 </data>
</openerp>

The module installed successfully and I see the <link.../> code being inserted in the page source, but I don't see the new favicon on my website. Could you advice?

0
Ruban Kannan
On 2/25/16, 5:44 PM

normally I do position="replace". It's what I use for Odoo8 though. I'll try this in Odoo 9 and let you know. Below is the template.


<template id="site_layout_home" inherit_id="website.layout" name="Site Home layout" priority="17">

<xpath expr="//head//title" position="replace">

<title>My Title</title>

</xpath>

<xpath expr="//head//link" position="replace">

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

</xpath>

</template>



Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/12/16, 6:58 PM
Seen: 1235 times
Last updated: 2/25/16, 5:44 PM