Odoo Help


How to implement facebook open graph on my product page?

Pascal Tremblay
on 9/23/15, 10:50 PM 2,704 views

Hello all,

I'm searching the right way to implement Facebook open graph meta tag on the product page of my shop on the front-end. 

Somebody has successfully done it?

Would you have some tips?



For example, I would search an example on how to fill dynamically those <meta> in a page like this product page : http://intimeetvilain.com/shop_iv/product/advanced-waterproof-jack-rabbit-1850

    <template id="website_lapagept.facebook_open_graph_tags_iv">

        <meta property="og:title" content="" />

        <meta property="og:description" content="" />

        <meta property="og:url" content="" />

        <meta property="og:image" content="" />



When I inspect the source code on this page you are reading, I see that all the open graph <meta> are well filled. Where could I find the code to do the same thing on my odoo?


When we click on the « share » button just below, four buttons appear. How could I implement those 4 buttons myself on my odoo? Where is the code?

What do you mean by Facebook Open Graph ? Is it means that you want to add a button of Facebook to share that product page into Facebook ? In this link (https://www.odoo.com/blog/odoo-news-5/post/top-apps-themes-in-odoo-store-314) there is 4 buttons ....Please confirm that do you want exactly like that ?

Emipro Technologies Pvt. Ltd.
on 9/24/15, 1:09 AM

Pascal Tremblay

--Pascal Tremblay--
| 5 3 7
Alma, Canada
--Pascal Tremblay--

Pascal Tremblay
On 9/25/15, 1:02 PM

Here is our answer. We have found it in the Odoo 9 code. It is surely not the best code, but it works for our needs at this moment. Thanks

<?xml version="1.0" encoding="utf-8"?>



                        <template id="website_lapagept.website_layout_iv" name="Main layout - IV">&lt;!DOCTYPE html&gt;

                                <html t-att-lang="lang and lang.replace('_', '-')"

                                        t-att-data-website-id="website.id if editable and website else None"

                                        t-att-data-editable="'1' if editable else None"

                                        t-att-data-translatable="'1' if translatable else None"

                                        t-att-data-view-xmlid="xmlid if editable else None"

                                        t-att-data-main-object="repr(main_object) if editable else None"



                                    <meta charset="utf-8" />

                                    <t t-if="main_object and 'website_meta_title' in main_object and not title">

                                            <t t-set="title" t-value="main_object.website_meta_title"/>


                                    <t t-if="main_object and 'name' in main_object and not title and not additional_title">

                                            <t t-set="additional_title" t-value="main_object.name"/>


                                    <t t-if="not title">

                                            <t t-set="title"><t t-if="additional_title"><t t-raw="additional_title"/> | </t><t t-esc="(website or res_company).name"/></t>


                                    <meta name="viewport" content="initial-scale=1"/>

                                    <meta name="description" t-att-content="main_object and 'website_meta_description' in main_object

and main_object.website_meta_description or website_meta_description"/>

                                    <meta name="keywords" t-att-content="main_object and 'website_meta_keywords' in main_object

and main_object.website_meta_keywords or website_meta_keywords"/>

                                    <meta name="generator" content="Odoo"/>

                        <!-- OpenGraph tags for Facebook sharing -->

                        <meta property="og:title" t-att-content="additional_title" />

                        <meta property="og:site_name" t-att-content="res_company.name" />

                        <meta property='og:url' t-att-content="request.httprequest.url_root+request.httprequest.path[1:end]"/>

                        <!-- OpenGraph pour le forum -->

                        <t t-if="main_object and 'plain_content' in main_object and main_object.plain_content">

                                <t t-set="og_description" t-value="main_object.plain_content[0:500]"/>

                                <meta property="og:description" t-att-content="og_description" />

                                <meta property='og:image' t-att-content="request.httprequest.url_root+'logo.png'"/>


                        <!-- OpenGraph pour les produits avec une description de vente -->

                        <t t-if="main_object and 'description_sale' in main_object and main_object.description_sale">

                                <t t-set="og_description_sale" t-value="main_object.description_sale"/>

                                <meta property="og:description" t-att-content="og_description_sale" />


                        <!-- OpenGraph pour les produits sans description de vente mais une description -->

                        <t t-if="main_object and not 'description_sale' and 'description' in main_object and main_object.description and not main_object.description_sale">

                                 <t t-set="og_description" t-value="main_object.description"/>

                                 <meta property="og:description" t-att-content="og_description" />


                        <!-- OpenGraph pour les images de produits -->

                        <t t-if="main_object and 'image' in main_object">

                                <meta property='og:image' t-att-content="request.httprequest.host_url+website.image_url(product, 'image_big', None if product_image_big else '300x300')" />


About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/23/15, 10:50 PM
Seen: 2704 times
Last updated: 3/4/17, 10:45 PM