EC-CUBE2の商品ページに構造化データを追加してみる

EC-CUBE 2.13.5で販売する商品がリッチリザルトに表示されるよう、商品詳細ページに構造化データマークアップを追加してみました。

<script type="application/ld+json">
{
    "@context": "https://schema.org/",
    "@type": "Product",
    "name": "<!--{$arrProduct.name|h}-->",
    "image": [
        "https://example.com<!--{$smarty.const.IMAGE_SAVE_URLPATH}--><!--{$arrProduct.main_image|sfNoImageMainList|h}-->"
    ],
    "description": "<!--{$arrProduct.name|h}-->",
    "brand": {
        "@type": "Thing",
        "name": "ブランド名"
    },
    "offers": {
        "@type": "Offer",
        "url": "https://example.com/products/detail.php?product_id=<!--{$arrProduct.product_id|h}-->",
        "availability": "https://schema.org/InStock",
        "price": "<!--{$arrProduct.price02_min_inctax}-->",
        "priceCurrency": "JPY"
    }
}
</script>

Google構造化データ テストツールでは、エラーは出ませんでした。(「推奨値がない」という警告は出る)
プレビューでもちゃんと表示されます。

が、実際の検索画面上の表示までは確認できていません。多分表示される、と思いたい。

2019年5月17日 (0)