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.
Another example are reviews. If you haven’t noticed, some search results display ratings on them, represented by stars. Just like this one below:
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:
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:
But when I checked the code generated by the plugin, it did not include the meta tag for
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).
- First, download the modified
functions.phpfile here. It’s in a zipped folder, so you’ll have to extract it after download.
- 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):
- On the next page, look for the
functions.phpfile. You can use ctrl + F on your keyboard to quickly search for it on the page.
- Open that
functions.phpfile 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.phpfile (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 .= '';
- 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):
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:
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:
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.