LoginSignup
6
6

More than 5 years have passed since last update.

meta-tagsで悩んでたこと。

Posted at

問題

meta-tagsを使ってOpenGraphのtypeをvideoとして設定しようとしたときに、

<meta property="og:type" content="video">
<meta property="og:video" content="http://www.youtube.com/v/2ZBtPf7FOoM?version=3&amp;autohide=1">
<meta property="og:video:type" content="application/x-shockwave-flash">
<meta property="og:video:width" content="480">
<meta property="og:video:height" content="360">

og:videoで指定する項目が複数あって、それをmeta-tagsを使って表現するにはどうしたらいいのか迷っていました。

解決策

meta-tagsのArrayHashを組み合わせて

set_meta_tags og: {
      :type     => 'video',
      :video => ["http://www.youtube.com/v/2ZBtPf7FOoM?version=3&amp;autohide=1",{
        :type => 'application/x-shockwave-flash',
        :width => '480',
        :height => '360'
      }]
    }

と、:videoの部分をArrayにして、og:videoのcontentにあたる部分と、og:video:xxxにあたる部分はHashの形で渡すようにすると上手くいきました。

6
6
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
6
6