Generate Video Sitemaps

In this topic, you will learn how to generate video sitemaps using the CMS API. There is a standard document called a sitemap that search engine indexers look for when examining your site. The sitemap concisely tells the search engines what content is exposed on your site, the metadata for that content, and where that content is located on your site. A sitemap is an XML file that follows a standard specification.

Sitemap types

There are two different flavors of sitemaps that you can (and should) create:

  • Sitemap – A sitemap that will index your content in the standard text based search engines such as www.google.com or search.yahoo.com
  • Video Sitemap – A sitemap that will index your content in media-centric search engines such as video.google.com

This topic focuses primarily on video sitemaps.

A proper SEO strategy for your video content will include creating both a standard sitemaps as well as a video sitemap. From a priority perspective, you want to create a standard sitemap first and then a video sitemap. Using the CMS API, you can create your sitemaps automatically, rather than compiling them by hand.

The example in this document is written in (node.js) JavaScript and would run on your server.

Standard sitemaps

Sitemaps follow the sitemap specification that is defined here: www.sitemaps.org. The purpose of the sitemap file is to provide a list of URLs on your site to the search engines.

Video sitemaps

A video sitemap is similar in concept to the standard sitemap file; there will be one entry in the sitemap file per video in your account. In fact, a video sitemap uses the sitemap schema as its base and adds additional tags specific to video metadata. For more detailed information, visit Google's video sitemap documentation.

The code required to create a video sitemap is almost exactly the same as that to create a sitemap. The only difference is that we add additional metadata about each video into each url entry.

Using the CMS API you can automatically generate the sitemap.xml file by fetching video data from a Video Cloud account and injecting relevant data into an XML template. CMS API requests require an access token for authentication. The access token must carry read permissions for videos.

Sample app

The sample code has been converted to an online working app.

Notes on building an app

  • All the data required for a video sitemap is available via the CMS API with one exception: the loc that provides the page URL where the video is published. You will either need to pull this from some other data source in your CMS, or you can store the information somewhere in the video metadata.
  • Some data from Video Cloud will need to be manipulated a bit. For example, the duration returned by the CMS API is in milliseconds, but in the sitemap you should provide it in seconds.
  • If you are providing player_loc instead of video_loc, you will need to know what the player URL will look like:
              https://players.brightcove.net//index.html?videoId={video_id}
            

    From this you can easily generate a URL for each video.

  • If instead you are providing video_loc, you will need to make an additional sources request for each video and pick out an HTTP MP4 rendition.