structured data

How to Properly Markup Your Video Posts for Google To Display the Right Rich Snippets of Your Pages in Search Results


In my previous post, I shared about how to use a plugin to easily generate what we call “structured data” that is properly marked up in our posts and/or pages. These structured data are what helps Google display appropriate rich snippets for our pages in search results. And if you’re still not familiar with the term, it is the set of information – little descriptions or preview about the content of the page.

Google recognizes several types of content and depending on the type of content on your page, Google can display specific and relevant information about it in the search results page. For example, a video. I’m sure you’ve tried a search for something and got back a list of results which includes some videos from Youtube. Google is able to display the thumbnails of those videos because they know that those items are videos through the properly marked up structured data within those pages – and technically, not because Youtube is their property.

video search result - rich snippets example
An example of the rich snippets displayed for a video search result.

 
Another example are reviews. If you haven’t noticed, some search results display ratings on them, represented by stars. Just like this one below:

review content type - google rich snippets example
An example of a review content type on the search results page

 
For a complete list of content types supported by Google, you may check out this page. But in this post, I’ll discuss how to properly mark up your video posts according to Google’s recommendations so that your rich snippets will be properly displayed for your pages in search results. This is going to improve your SEO as well because it helps search engines understand your content better. And if you’re using your site for internet marketing, this info could come in handy and could mean more profits.

So, here it goes. I’m already using the “All in One Schema.org Rich Snippets” plugin and if you have checked my previous post, you’ll see why I chose it and why it’s the one I recommend out of the many similar plugins out there. But a new acquaintance of mine from a Facebook blogging group, asked me about how the plugin works for videos since he wants to use it for his video posts.

I couldn’t provide a reliable answer that is from my own experience straight away because I haven’t actually used the video mark up feature of the plugin, yet. Before this post, I was only using it for my “review” type of content. So I decided to try and use the feature for the “video” type now. Here are the fields available to you if you choose to mark up your post as a video type:

configure rich snippets for video content type
Configure rich snippets for video content type

 
As you can see, if you use this plugin to properly mark up your video posts with structured data, you already have everything you need to comply with Google’s recommendations. You can find Google’s recommended proper on-page mark up for video posts here.

But when I tried to preview how my page would look in the search results page, it wasn’t what I expected. No video thumbnail was shown. So I checked the code generated by this plugin for the particular video post I’ve used it on. And I found out that it lacks one of the required tags that Google looks for in a page that is marked up as a video.

For a video type post, Google requires the following meta property tags to be present:

  1. name
  2. description
  3. thumbnailURL and
  4. Either contentURL or embedURL

But when I checked the code generated by the plugin, it did not include the meta tag for contentURL or embedURL:

structured data markup code

So if we are going to use this plugin for our video posts and if we want it to generate all the mark-ups required by search engines, we need to make a little code modification/addition. But don’t worry, it’s going to be easy as pie only. Just follow the following steps (Please note: I’m using version 1.1.3 of this plugin at the time of the latest update to this post).

  1. First, download the modified functions.php file here. It’s in a zipped folder, so you’ll have to extract it after download.
     
  2. In your WP admin area, go to  Plugins  >>  Editor  and then select the plugin we need to edit (All in One Schema.org Rich Snippets):
    edit all in one schema.org rich snippets plugin
    Select “All in One Schema.org Rich Snippets” plugin to edit
     
  3. On the next page, look for the functions.php file. You can use  ctrl + F  on your keyboard to quickly search for it on the page.
    All in one Schema.org Rich Snippets functions file
    Click to edit the functions.php file
     
  4. Open that functions.php file that you’ve downloaded in step 1 above in notepad, and then copy all content (you can use  ctrl + A  on your keyboard). And then come back to this edit page, select all of the content, delete it and paste the one that you’ve copied from the downloaded file. What I’ve done there is I only added the following lines of code into the functions.php file (on line 615 to be exact):
     

            if(trim($video_url) != "")
                $video .= '';    
    

     
    But I don’t want you to have a hard time looking for it anymore, so better just replace everything. Still, of course you can also do it the hard way and insert this code right after the line:
     

    $video .= '';

     

  5. And that’s it. All that’s left is to click the  Update File  button!

After applying this modification to the plugin, you should see the following if you check the source code on the front-end (if you still want to bother):

structured data embedURL meta tag
The meta tag “embedURL” should now be included

 

And then you can check how your page will look like in Google by using their structured data testing tool. If everything’s working properly, you should see a preview that looks like this:

video search result - rich snippets example
An example of the rich snippets displayed for a video search result.

 

Just a little disclaimer: Google does not guarantee that it can show your video thumbnail or any of your video post’s rich snippets in the preview when you use their tool. Check out this page where you can read about it. At the end of the first paragraph, they say that “You may not always see a result preview even when video markup is found.”.

But just to make sure, you can scroll down to the bottom of the preview/testing page and you can confirm that Google is reading your markup properly if it picks up these details under the “Item” section:

item - rich snippet details
click to view enlarged image

 

And that should wrap it up. This has been a long post with a little over a thousand words already. I hope this would help you and not just bore you to death. 😀 If you have any questions or suggestions, please throw them in on the comments below.

Nimrod

People don't really know what they want until they learn about it. Marketing educates people about what they want. I'm a marketer, therefore I'm an educator.
Menu