3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

HTMLでTwitterカードを設定するコード

Last updated at Posted at 2021-04-19

最近のWordPressテーマだと標準で実装されていることが多いのですが、無料テーマとかだと実装されていないこともある「Twitterカード設定」

TwitterでURL付きのツイートをしたときにカードとして画像が表示されると目に止まりやすいので必然的にCTRも上がる。

そこで今回はHTMLのコードでTwitterカードを実装する方法をメモとして残しておきます。

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@Twitterのユーザー名" />
<meta property="og:image" content="表示させたい画像のURL" />

最低限必要なのはこれだけ。

ページによって表示させる画像を変えたい、場合とかだとWordPressの有料テーマならアイキャッチ画像を自動で設定してくれるものが多い。

あとカードの種類は「summary_large_image」以外に「summary」があるけどカードサイズも画像サイズも小さいので人によって好みが分かれる。

*WordPressの人は外観からテーマエディターからheader.php内にコードを記入しましょう

HTML/CSSのお役立ち情報

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?