Hi all,
I have set up my Twitter Card and all seems to be working except for product images do not show up - see below. When I ran an SEO tool it said missing 'twitter.image' and 'twitter.site'. Any help would be greatly appreciated.
My site is https://lovelittlemoon.com.au
The code I used:
<meta name="twitter:site" content="@LoveLittleMoon_" />
{% if template contains 'product' %}
<meta name="twitter:card" content="product" />
<meta name="twitter:title" content="{{ product.title | escape }}" />
<meta name="twitter:description" content="{{ product.description | strip_html | strip_newlines | truncatewords: 60, '' | escape }}" />
<meta name="twitter:image" content="{{ product.featured_image.src | product_img_url: 'large' }}" />
<meta name="twitter:label1" content="Price" />
<meta name="twitter:data1" content="{% if product.price_varies %}From {% endif %}{{ product.price | money_with_currency | strip_html }}" />
{% if product.vendor == blank %}
<meta name="twitter:label2" content="Availability" />
<meta name="twitter:data2" content="{% if product.available %}In stock{% else %}Out of stock{% endif %}" />
{% else %}
<meta name="twitter:label2" content="Brand" />
<meta name="twitter:data2" content="{{ product.vendor | escape }}" />
{% endif %}
{% elsif template contains 'article' %}
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="{{ article.title | escape }}" />
<meta name="twitter:description" content="{{ article.excerpt_or_content | strip_html | truncatewords: 60, '' | escape }}" />
{% assign img_tag = '<' | append: 'img' %}
{% if article.content contains img_tag %}
{% assign src=article.content | split: 'src="' %}
{% assign src=src[1] | split: '"' | first | remove: 'https:' | remove: 'http:' %}
{% if src %}
<meta property="twitter:image" content="http:{{ src }}" />
{% endif %}
{% endif %}
{% endif %}
Hi, Our Dev Team looked at your query. We think that you are not getting the product image correctly. Please try this snippet:
<meta name="twitter:image" content="{{ product.featured_image}}" />
Please let us know how you go.
Jasmine | Plak theme support
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as a Solved Solution
Welcome to the Shopify Forum Community provided by Plak ThemeLLC, a place where you can discuss about eCommerce and Shopify, solve technical issues, get help with Shopify Design, Apps integration, Marketing, Facebooks ad, Google ads and more.
Before posting, we invite you to read and follow the forum rules | We also support any questions related to Free Shopify themes :Dawn, Express, Minimal, Brooklyn, Narrative, Supply, Debut, Venture, Boundless and Simple