Hello Everybody,
I tried a lot of Open graph codes but all have issues (multiples values or missing)
Can somebody has an open graph code working ?
Using Turbo Theme
My current code :
{%- assign og_title = page_title -%}
{%- assign og_url = canonical_url -%}
{%- assign og_type = ‘website’ -%}
{%- assign og_description = page_description | default: shop.description | default: shop.name -%}
{%- if settings.share_image -%}
{%- capture og_image_tags -%}
{%- endcapture -%}
{%- capture og_image_secure_url_tags -%}
{%- endcapture -%}
{%- endif -%}
{%- case template.name -%}
{%- when ‘product’ -%}
{%- assign og_title = product.title | strip_html -%}
{%- assign og_type = ‘product’ -%}
{%- if product.images.size > 0 -%}
{%- capture og_image_tags -%}
{%- for image in product.images limit:3 -%}
{%- endfor -%}
{%- endcapture -%}
{%- capture og_image_secure_url_tags -%}
{%- for image in product.images limit:3 -%}
{%- endfor -%}
{%- endcapture -%}
{%- endif -%}
{%- when ‘article’ -%}
{%- assign og_title = article.title | strip_html -%}
{%- assign og_type = ‘article’ -%}
{%- assign og_description = article.excerpt_or_content | strip_html -%}
{%- if article.image -%}
{%- capture og_image_tags -%}
{%- endcapture -%}
{%- capture og_image_secure_url_tags -%}
{%- endcapture -%}
{%- endif -%}
{%- when ‘collection’ -%}
{%- assign og_title = collection.title | strip_html -%}
{%- assign og_type = ‘product.group’ -%}
{%- if collection.image -%}
{%- capture og_image_tags -%}
{%- endcapture -%}
{%- capture og_image_secure_url_tags -%}
{%- endcapture -%}
{%- endif -%}
{%- when ‘password’ -%}
{%- assign og_title = shop.name -%}
{%- assign og_url = shop.url -%}
{%- assign og_description = shop.description | default: shop.name -%}
{%- endcase -%}
{%- if template.name == ‘product’ -%}
{%- endif -%}
{{ og_image_tags }}
{{ og_image_secure_url_tags }}
{%- unless settings.social_twitter_link == blank -%}
{%- endunless -%}