Jump to content

How to configure og: image in prestashop 8


Recommended Posts


I have the latest prestashop version (8.1.2). When I attempt to use the facebook share button (configured only with the native modules), it is sent without the product image.

Seing in facebook debugger, it has this warning "Inferred Property The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags." Seing in file head.tpl, the og image is missing. I tried already some codes I saw on google search to put the og image meta property but they doesn't work.

Someone knows the necessary og image meta property code?

The code I tried that was nearest to give the correct url og image was this:

<meta property="og:image" content="{$link->getImageLink ($product->link_rewrite, $cover.id_image, 'large_default')}">

but is still missing to assume the number prestashop put in the image url  

The image url's schema I have in my product pages are like that: https://mywebsitename.pt/numberattributedbyprestashop-large_default/nameoftheproduct.jp


I'm grateful for every help someone can gave me. Thank you

Link to comment
Share on other sites

As of my last knowledge update in January 2022, PrestaShop versions generally don't go up to 8; PrestaShop's latest major version was 1.7.x. However, if there have been new releases since then, the process might be similar.

Configuring Open Graph (OG) images in PrestaShop involves setting the appropriate meta tags in your theme.

Here's a general guide:

Locate the Header Template:

In PrestaShop, you often need to modify the header template file. This file is typically located in the "themes/your_theme/header.tpl" directory.

Add Open Graph Meta Tags:

Open the "header.tpl" file in a text editor.

Find the <head> section.

Add Open Graph meta tags, including the "og:image" tag. Example:

    <!-- Other head elements -->
    <meta property="og:image" content="URL_TO_YOUR_IMAGE" />


Dynamic OG Images (Optional):

If you want to dynamically set OG images based on the content, you might need to customize your theme or use a module that allows for dynamic OG images.

Clear Cache:

After making changes, clear the PrestaShop cache to ensure that the changes take effect.

Verify on Social Media Platforms:

Test your pages on social media platforms to ensure that the OG image is displayed correctly. You can use tools like the Facebook Sharing Debugger or Twitter Card Validator for this.

Remember, the specific steps can vary based on your PrestaShop version, theme, and any installed modules. Always make a backup of your files before making changes, and if possible, consult the official PrestaShop documentation or community forums for the most accurate and up-to-date information.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...