Hi there,
We’re currently using the Impulse theme, and I’ve noticed that while the theme includes general Open Graph (OG) tags by default, it doesn’t seem to include article-specific logic to pull the blog post’s featured image as the OG image.
Has anyone else run into this issue?
Does anyone know what Liquid code we need to add or customize to conditionally use the article’s featured image on a blog article page?
Any help or examples would be much appreciated!
Best regards,
Nica
Bathroomlux
Hi @bathroomlux ,
Based on your given explanationYou’ll need to modify your theme’s theme.liquid or a relevant snippet (like social-meta.liquid or head.liquid if your theme has one) to conditionally output the article’s featured image as the og:image meta tag when viewing a blog post.
Please use the below code :
{% if template contains ‘article’ %}
{% if article.image %}
{% endif %}
{% elsif template contains ‘blog’ %}
{% if blog.image %}
{% else %}
{% endif %}
{% else %}
{% endif %}
Note: Replace YOUR_STORE_ID and YOUR_DEFAULT_IMAGE.jpg with your actual store ID and the filename of your default image. You can find your store ID in the URL of your Shopify admin
Please use this code and let me know !
Thanks !