We have developed a brand new theme for our website with some hot frameworks like Bootstrap and Redux. The theme is clean, secure, fast and mobile friendly. Did we think it was all that was needed? Yes. Until our impressions on Google started to decline.
The impressions didn’t decline fast as it happens with Google updates like Panda. It happened slowly over a period of time.
We couldn’t understand the reason for that until we saw this in Google Analytic Tools:
Errors gone to zero and that is good! But items? We had several hundreds of articles on the website and only 1 item? Isn’t the blue line supposed to show the number of pages with data?
What we were missing in our theme was Structured Data – a way to tell search engines about our content. Only humans can take a look at a webpage and tell what is title, what’s content and what’s tags, ads or other relevant information. Search engine bots need the content to be annotated and tell in a specific structured way that this is a title, this is content, when the post was created and updated and who is the author.
Running our website through Google Structured Data Testing tool revealed that we didn’t have anything. Remember that the result should tell Google what your page contains. Ours were Green, but contained nothing.
If you do SEO for your online business, then you must know exactly how do search engines see your website.
A list of markup titles can be found at microformats.org. There’s a microformats2 markup coming up, but we in this post deal with classic microformat hEntry.
Now that we have identified the problem we need to fix it. WordPress does a lot of work itself. The only thing we need to do is to annotate all posts, pages and articles with the right class name – hentry.
Ensure that you use a post_class function when providing class names for posts and articles. This is, by the way, also a requirement if you are going to submit your WordPress theme to Themeforest.
Here is our new code:
<div <?php post_class(); ?>> <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <h1><?php get_template_part( 'sections/title', 'post'); ?></h1> <?php the_content(); } } ?> </div>
Hentry is a root schema. You will also need to provide more information along with it in order for search engines to fully understand your content. Those are: title, author, updated, created and so on.
You can either provide each and every one of them alone in your page template.
I chose an easier approach – a function that appends all the necessary data to the end of each content dynamically:
function add_suf_hatom_data($content) { $t = get_the_modified_time('F jS, Y'); $author = get_the_author(); $title = get_the_title(); if (is_home() || is_singular() || is_archive() ) { $content .= '<div class="hatom-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>'; } return $content; } add_filter('the_content', 'add_suf_hatom_data');
Now we have all the data and our Google position is rising: