網頁仔 JAI Studio
← 全部實作任務

Shopify theme.liquid 貼 schema:唔使裝 app 都搞掂

要做嘅嘢:喺你 Shopify 主題嘅 theme.liquid 入面,</head> 之前貼一段 Organization schema。二十分鐘。

依據:Shopify 主題開發文件。產品 schema 睇 ChatGPT 購物嗰篇,呢篇搞全站層面嘅 Organization + WebSite。

步驟

  1. 後台 → 網店 → 佈景主題 → 你而家用緊嗰個 → 「編輯程式碼」。
  2. 左邊搵 layout/theme.liquid
  3. </head>,喺佢之前貼:
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": {{ shop.name | json }},
  "url": {{ shop.url | json }},
  "description": {{ shop.description | default: shop.name | json }}
}
</script>
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": {{ shop.name | json }},
  "url": {{ shop.url | json }}
}
</script>
  1. 儲存。搞掂。

{{ ... | json }} 係 Liquid 嘅安全輸出,會自動處理引號 —— 照抄就得,唔使自己手寫資料。

點樣驗證

curl -s https://你店舖域名/ | grep -o '"@type":"Organization"'

見到即係出咗喺原始 HTML。再去 Rich Results Test 確認冇報錯。

注意

  • 改主題之前,「動作 → 複製」備份一份主題先。
  • 換主題要重新貼 —— 記低喺邊度貼過。
  • 某些付費 SEO app 會出重複嘅 Organization schema。裝咗就二揀一,重複 schema 會亂。

香港實例

未有公開實例。你貼完 curl 見到嗰行,就係你店嘅實例。

想我哋幫手套上去你個網站?話我哋知你睇緊邊篇。