Generate Video Sitemaps
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.
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.
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.
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
locthat 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
durationreturned by the CMS API is in milliseconds, but in the sitemap you should provide it in seconds.
- If you are providing
video_loc, you will need to know what the player URL will look like:
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.