Odoo Help


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.


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

Pascal Tremblay
on 11/5/15, 10:45 PM 583 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 2 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 ».

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)


Asked: 11/5/15, 10:45 PM
Seen: 583 times
Last updated: 11/7/15, 12:56 PM