Movatterモバイル変換


[0]ホーム

URL:


Zenn
hirohiro
Closed4

[Twitter Cards] meta name="twitter:label1" の謎

Twitter
Open Graph protocol
hirohiro

イントロ

<metaname="twitter:label1"content="Written by"><metaname="twitter:data1"content="hiro"><metaname="twitter:label2"content="Reading time"><metaname="twitter:data2"content="2 minutes">

こういうメタ要素をheadに入れておくと、Slackのプレビューでは下記のように反映される。

ただ、Twitterでは表示されない。

hirohiro

カードプロパティ

twitter:label1,twitter:data1,twitter:label2,twitter:data2 は公式リファレンスには載っていない。

https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup

Product Card

https://dev.twitter.com/docs/cards/types/product-cardはリンク切れしているようだったので、Wayback Machine経由で確認ができた。

概要

The Product Card is a great way to represent retail items on Twitter, and to drive sales. This Card type is designed to showcase your products via an image, a description, and allow you to highlight two other key details about your product.
[訳] 製品カードは、Twitterで小売商品を表現し、売り上げを伸ばすための優れた方法です。このカードタイプは、画像や説明で商品を紹介し、商品に関する他の2つの重要な詳細を強調できるように設計されています。

スクリーンショット

webmobile
imageimage

コード

<metaname="twitter:card"content="product"><metaname="twitter:site"content="@twitter"><metaname="twitter:creator"content="@twitter"><metaname="twitter:title"content="Logo Mug"><metaname="twitter:description"content="The perfect pick-me-up. Enjoy your favorite blend with this coffee mug featuring the Twitter logo. Make every work day good to the last drop."><metaname="twitter:image"content="https://twitter.siglercompanies.com/graphics/00000001/mug-new.jpg"><metaname="twitter:data1"content="$3"><metaname="twitter:label1"content="Price"><metaname="twitter:data2"content="Black"><metaname="twitter:label2"content="Color">

プロパティ

プロパティ名概要必須
twitter:data1このフィールドには文字列が必要です。価格、在庫のあるアイテム、サイズなどのラベルの値を指定できます。必須
twitter:label1このフィールドには文字列も必要であり、提供するデータのタイプ(価格、国など)を指定できます。必須
twitter:data2
twitter:label2

twitter:card

公式リファレンスを参照するとtwitter:cardに指定できるタイプは以下の通り。

カードのプロパティ説明
twitter:cardカードタイプは、“summary”、“summary_large_image”、“app”、“player”のいずれかになります。

そもそも<meta name="twitter:card" content="product">の指定が意味をなさないようになっている。

hirohiro

結論

twitter:label1,twitter:data1,twitter:label2,twitter:data2 は Product Card の仕様だった。

このスクラップは2020/12/17にクローズされました
ポスト
hiro

ZOZO / フロントエンドエンジニア基本的に自前のブログで記事投稿が多いです。


[8]ページ先頭

©2009-2025 Movatter.jp