音楽(Music)の構造化データをマークアップする方法

音楽(Music)の構造化データをマークアップする方法

Photo Austin Neill via Unsplash

音楽(Music)の構造化データをマークアップする方法を紹介します。

音楽(Music)の構造化データのサンプル

アーティストの名前を検索したときなど、Googleは検索結果のナレッジグラフに楽曲に関する情報を表示することがあります。

音楽に関する構造化データをマークアップすることで、アーティストや楽曲に関する情報をGoogleにより正確に伝えることができるようになります。

音楽の構造化データをマークアップする

音楽(Music)の構造化データをJSON-LDでマークアップする方法です。JSON-LDはページのどこに記述しても問題ありませんが、通常は<head>タグ内に記述します。

アーティストに関する情報

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "MusicGroup",
  "url": "http://www.example.com/artist/Katy-Perry/",
  "image": [
    "https://example.com/photos/1x1/photo.jpg",
    "https://example.com/photos/4x3/photo.jpg",
    "https://example.com/photos/16x9/photo.jpg"
   ],
  "name": "Katy Perry",
  "sameAs": "http://www.katyperry.com",
  "description": "Katy Perry is a pop music artist.",
  "potentialAction": {
    "@type": "ListenAction",
    "target": [
      {
        "@type": "EntryPoint",
        "urlTemplate": "http://www.example.com/artist/Katy-Perry/?autoplay=true",
        "actionPlatform": [
          "http://schema.org/DesktopWebPlatform",
          "http://schema.org/IOSPlatform",
          "http://schema.org/AndroidPlatform"
        ],
        "InLanguage": "USD"
      },
      {
        "@type": "EntryPoint",
        "urlTemplate": "android-app://com.example.app/examplescheme/artist/Katy-Perry/?autoplay=true",
        "actionPlatform": "http://schema.org/AndroidPlatform",
        "InLanguage": "USD"
      }
    ],
    "expectsAcceptanceOf": {
      "@type": "Offer",
      "eligibleRegion": [
        {
          "@type": "Country",
          "name": "US"
        },
        {
          "@type": "Country",
          "name": "BR"
        }
      ]
    }
  }
}
</script>

アルバムに関する情報

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "MusicAlbum",
  "url": "http://www.example.com/album/Artpop/",
  "image": [
    "https://example.com/photos/1x1/photo.jpg",
    "https://example.com/photos/4x3/photo.jpg",
    "https://example.com/photos/16x9/photo.jpg"
   ],
  "name": "Artpop",
  "sameAs": "https://en.wikipedia.org/wiki/Artpop",
  "description": "Artpop (stylized as ARTPOP) is the third studio album by American singer Lady Gaga.",
  "potentialAction": {
    "@type": "ListenAction",
    "target": [
      {
        "@type": "EntryPoint",
        "urlTemplate": "http://www.example.com/album/Artpop/?autoplay=true",
        "actionPlatform": [
          "http://schema.org/DesktopWebPlatform",
          "http://schema.org/IOSPlatform",
          "http://schema.org/AndroidPlatform"
        ],
        "InLanguage": "USD"
      },
      {
        "@type": "EntryPoint",
        "urlTemplate": "android-app://com.example.app/examplescheme/album/Artpop/?autoplay=true",
        "actionPlatform": "http://schema.org/AndroidPlatform",
        "InLanguage": "USD"
      }
    ],
    "expectsAcceptanceOf": {
      "@type": "Offer",
      "eligibleRegion": [
        {
          "@type": "Country",
          "name": "US"
        },
        {
          "@type": "Country",
          "name": "BR"
        }
      ]
    }
  }
}
</script>

音楽の構造化データの属性

アーティストとアルバムに関する属性

属性必須説明
description必須アーティストのプロフィールやアルバムの説明
image推奨アーティストやアルバムの画像
name必須アーティストやアルバムの名前
potentialAction必須アクションに関する情報
※アクションに関する属性を参照
sameAs推奨アーティストやアルバムに関するページのURL
例: Wikipedia
url必須アーティストやアルバムのランディングページのURL

アクションに関する属性

属性必須説明
expectsAcceptanceOf必須アクションのコンディション(利用可能な国やISOコード)に関する情報
expectsAcceptanceOf.eligibleRegion必須アクションが可能な国に関する情報
expectsAcceptanceOf.eligibleRegion.name必須アクションが可能な国の国コード
target必須アクションに関する情報
target.actionPlatform必須アクションが可能なプラットフォーム
下記から複数選択可
http://schema.org/DesktopWebPlatform: デスクトップのWebブラウザ用
http://schema.org/MobileWebPlatform: モバイルのWebブラウザ用
http://schema.org/AndroidPlatform: Androidアプリ用
http://schema.org/IOSPlatform:
iOSアプリ用
target.urlTemplate必須アクションに関する詳細ページのURL