Odoo Help


How to fill correctly my « og:image » tag in my product page with « suggested products »?

Pascal Tremblay
on 11/5/15, 10:45 PM 1,131 views

Hello all,

On our shop product page (example : http://intimeetvilain.com/shop/product/lubrifiant-pure-4-onces-901 ), we have this code in the template :

<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')" />

With this code we always had the right product image when we put a product page url on facebook.

But since we also have a « suggested product » section at the bottom of the product page, the image is never the right one on Facebook. Our code always take image of THE LAST product in the « suggested products » section.

How could we correct this and take always an only image from the main product in the og:image tag?



Pascal Tremblay

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

Pascal Tremblay
On 11/7/15, 12:49 PM

A new miracle!

Here is the solution :

     <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[0], 'image')" />

This way, the image in og:image facebook tag is always the image of the main product and not the image of one of the « suggested products ».

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: 11/5/15, 10:45 PM
Seen: 1131 times
Last updated: 11/7/15, 12:56 PM