Liquid、JavaScriptなどに関する質問
Shopifyで商品をアップしてTwitterやFacebook、pinterestにシェアしようとした時、シェアされる画像が商品画像ではなくブランドロゴになってしまいます。
何かアドバイスいただけないでしょうか。
以下がコードになります。
{%- liquid
assign og_title = page_title
if og_title == blank
assign og_title = shop.name | escape
endif
assign og_url = canonical_url | default: shop.url
assign og_type = 'website'
assign og_description = page_description
if og_description == blank
assign og_description = shop.description | default: shop.name | escape
endif
if template.name == 'product'
assign og_type = 'product'
elsif template.name == 'article'
assign og_type = 'article'
elsif template.name == 'collection'
assign og_type = 'product.group'
elsif template.name == 'password'
assign og_url = shop.url
endif
-%}
<meta property="og:site_name" content="{{ shop.name | escape }}">
<meta property="og:url" content="{{ og_url }}">
<meta property="og:title" content="{{ og_title }}">
<meta property="og:type" content="{{ og_type }}">
<meta property="og:description" content="{{ og_description }}">
{%- if page_image -%}
<meta property="og:image" content="http:{{ page_image | img_url: '1200x1200' }}">
<meta property="og:image:secure_url" content="https:{{ page_image | img_url: '1200x1200' }}">
<meta property="og:image:width" content="{{ page_image.width }}">
<meta property="og:image:height" content="{{ page_image.height }}">
{%- endif -%}
{%- if template.name == 'product' -%}
<meta property="og:price:amount" content="{{ product.selected_or_first_available_variant.price | money_without_currency | strip_html }}">
<meta property="og:price:currency" content="{{ cart.currency.iso_code }}">
{%- endif -%}
{%- unless settings.social_twitter_url == blank -%}
<meta name="twitter:site" content="{{ settings.social_twitter_url | split: 'twitter.com/' | last | prepend: '@' }}">
{%- endunless -%}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ og_title }}">
<meta name="twitter:description" content="{{ og_description }}">
Shopify アカデミーの学習パスと認定スキルバッジExpanding Your Shopify Business Internationallyを活用して、国際的にビジネ...
By Shopify Feb 7, 2025Shopify アカデミーの学習パスB2B on Shopify:立ち上げとカスタマイズで卸売販売に進出しましょう。これら3つの無料コースは、ShopifyストアでB2B機能...
By Shopify Jan 31, 2025サポートの選択肢が増えていく中、最適となる選択の判断が難しくなっているかと存じます。今回は問題の解決に最適となるサポートの選択方法を、紹介させて頂きます。 選択肢のご紹介...
By Mirai Oct 6, 2024