Google announced on Wednesday a new way to tag your blog posts with Google news keywords metatag data so that it helps Google News determine what the best content is for particular news stories.
In Google’s announcement, they shared some example code on what your meta data needs to look like in order for the crawlers to read and access your tags.
Well, as is typical of Google, they NEVER give you detailed instructions on how to implement it – they always keep it basic at the HTML page level.
I mean, don’t they realize that most of the sites in Google News are ran on WordPress, or some other type PHP CMS?
Anyway, I finally figured out how to do it and get it working correctly on this site (Tablet Crunch) which is a WordPress site. Here’s how I got it working:
How to setup Google News keywords metatag (news_keywords) in your WordPress blog:
#1: Setup code in your header.php
The first thing you need to do is add some code right before the closing head tag </head> in your header.php. Here’s the exact code I’ve added to my header.php (again, right before the closing head tag:
<meta name=”news_keywords” content=”<?php
while (have_posts()) : the_post();
$keywords = get_post_meta($post->ID, ‘keywords’, false);
echo ‘iPad, Android tablets, tablet pc, tablet pcs,’;
One important note to make here: you see the second instance of echo where I have ‘iPad, Android tablets, tablet pc, tablet pcs,’; you have to change those keywords to your own site’s relevant keywords and phrases. This second echo reference defines the default keyword phrases to use in each of your posts if you don’t specific keyword phrases in your custom fields on your individual posts (I’ll explain this more in a minute).
2) create a custom field on your individual posts
Now all you need to do is create a custom field in your individual posts pages called “keywords” (without quotes) as the custom field name.
That’s right – just the word “keywords” (again, without quotes) as the custom field name.
And then you’ll want to add your news related keywords in the “Value” field as a comma separated list.
So long as you have the code properly inserted into the header.php, and you’ve created the custom field correctly, you can now add your news related keywords into your post.
You’ll know if you’ve done everything right by viewing the page source of your post and searching for “news_keywords” (without quotes). And you should now see the meta tag and the keywords you specified.
Here’s a summary of what Google had to say about their news_keyword meta tag on Wednesday:
…today we’re excited to announce a news_keywords metatag. The goal is simple: empower news writers to express their stories freely while helping Google News to properly understand and classify that content so that it’s discoverable by our wide audience of users.
Similar in spirit to the plain keywords metatag, the news_keywords metatag lets publishers specify a collection of terms that apply to a news article. These words don’t need to appear anywhere within the headline or body text. Taking the Variety example above, news keywords such as “stocks”, “stock market”, or “crash” would be helpful in allowing Google News to better understand the article content for ranking without forcing the editors to water down the creativity of a great headline. Because the metatag appears only as part of the HTML code of a page, visitors to a site won’t ever see the magic under the hood.