1

I'm expanding a static site with playable videos contextualized in a TV Series and I would like to know how to properly fill in the tags url and datePublished.

Currently, with only one embeddable source, the JSON-LD generated is:

<script type="application/ld+json">
{
  "@context" : "http://schema.org",
  "@type" : "TVEpisode",
  "partOfTVSeries" : {
    "@type" : "TVSeries",
    "name" : "Name of the Show"
  },
  "keywords": "a,list,of,comma,separated,tags",

  "partOfSeason" : {
    "@type" : "TVSeason",
    "seasonNumber" : "1"
  },
  "episodeNumber" : "1",


  "image" : "absolute/path/to/video/image.jpg",

  "url" : "permalink",

  "review" : {
    "@type" : "Review",
    "author" : {
      "@type" : "Person",
      "name" : "Summary Author Name"
    },

"reviewBody" : "Summary"
  }
}
</script>

With only one embeddable source it was just a matter of using the template functions to retrieve the Permalink and the Date in which the video has been published.

But I don't know how to do it for multiple sources.

I tried to simply duplicate the whole block, simulating an iteration, changing the mentioned values but when testing with Structured Data Testing Tool, although no errors were reported, the second entry was ignored.

unor
  • 92,415
  • 26
  • 211
  • 360
user5613506
  • 286
  • 1
  • 16

1 Answers1

3

In JSON-LD, if you have multiple values for a property, you have to use an array as value instead of repeating the property.


You could provide multiple VideoObject items for the TVEpisode, by using TVEpisode’s associatedMedia/encoding property:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "TVEpisode",


  "associatedMedia": [
    {
      "@type": "VideoObject",
      "name": "Source 1"
    },
    {
      "@type": "VideoObject",
      "name": "Source 2"
    }
  ]


}
</script>

Now you can differentiate between the metadata for the TV episode and for its videos.

unor
  • 92,415
  • 26
  • 211
  • 360
  • Using `associatedMedia` looks more organized to me. But if I suppress some fields common to all media, would I have any sort of suboptimal results for what matters? For example, all videos have the same `headline`, `thumbnailUrl`, `image` (varying with the seasons, of course) `height`, `width` and `keywords`. Since `TVEpisode` looks like "inherits" from `CreativeWork` through `Episode`, could I move these entries out of the `associatedMedia`? – user5613506 Sep 26 '17 at 16:51
  • @user5613506: Sure, if the data applies to the episode (and not just to a specific recording of it), you should specify it (at least) on the `TVEpisode` item. -- Depending on your use case, it can make sense to specify this data on the `VideoObject`s, too (so duplicating the data), for example, when a certain consumer ignores `TVEpisode` items because it only recognizes items of the `VideoObject` type. Unless you know of such a consumer, I wouldn’t go this way, though. – unor Sep 26 '17 at 17:57
  • Well, after adjusting the data-structure to the `associatedMedia` format (Hugo syntax is a pain for this >.<) I tested and because `associatedMedia` requires a `VideoObject` and `VideoObject` has a few required fields (namely `name`, `description` and `thumbnailUrl`), even though they were already defined on `TVEpisode` I had to duplicate in there. It's not a big deal, I suppose, but in any event, thank you for the help. :) – user5613506 Sep 26 '17 at 23:12
  • @user5613506: In case you didn’t consider it yet: It might be easier for you to use RDFa or Microdata instead of JSON-LD, as you can add it directly to the HTML templates. --- Note that there are no required properties in Schema.org. Consumers like Google Search may require certain properties, but these are always only required for one of their search features -- if you don’t want the feature (or if you can’t get it, because you don’t have all the required data), there is no need to provide these properties. – unor Sep 26 '17 at 23:24