Adding WordPress Excerpts to Google+ Posts

Here’s a little bit of web geekery for you that I once posted about Facebook, but it applies just as well to the new Google+ Pages and Profiles. I want to share links on Google+, but every time I do that I get the same link info no matter what blog post I’m linking to. How do I change that?

When you add a link to your Google+ posts, Google pulls that page’s Meta Description and adds it to the link. The problem is that, by default, WordPress uses your blog’s main description for its Meta Description on every single page. So this is what I get:

Bad Meta on Google+

No Meta Description? Bad Birdie.

It does this because my theme’s Header had NO Meta Description tag. Google+ was forced to just pull the first few lines of text which, unfortunately, was my menu system. Oops!

Telling The Short Story

So how do you get a concise excerpt to show up in G+ posts? Change that Meta Description tag to look like this:

<meta name='description' content='<?php

if ( is_single() ) {

the_excerpt_rss();

} else { ?>

THIS IS WHERE YOU'D TYPE IN WHAT YOU WANT TO DISPLAY OTHERWISE.

<?php } ?>'>

But here’s the kicker: The tag has to be moved inside the WordPress Loop. It’ll still work even if it’s not in the Header, so don’t worry about that. If you’re using a multi-loop theme, plant this code inside the loop that you use for your blog posts and page content. Once that’s in place, you’ll get this:

Google+ Pulling a Good Excerpt

Clear, Concise, BETTER.

Telling The Short Story With Branding

If you’d like to add a sentence that precedes every description and will stand alone if necessary, Chris Penn suggested this as an alternative:

<meta name='description' content='THIS IS WHERE YOU'D TYPE IN WHAT YOU WANT TO DISPLAY OTHERWISE.<?php

if ( is_single() ) {

echo ' - ';

the_excerpt_rss();

} ?>'>

Controlling the Excerpt

WordPress, of course, gives you total control over what goes in this spot too. If you don’t type in a specific excerpt when writing a blog post, WordPress grabs the first few lines of the post instead. If you’d rather type your own excerpt, bear in mind that this could show up in an RSS feed, next to an image in a Facebook or Google+ post, or anywhere else.

Many SEO plugins will alter the excerpt further, but you’re probably using one of these plugins because they do this. For more information on the WordPress the_excerpt_rss() tag, read their documentation here.

  • O m g. I had no idea who coded your website..
    And seeing this, I’m led to believe it’s ALL YOU.
    Is that possible!?  How can so much knowledge exist in one man’s head!?… besides Dexter Peterson. D:

  • O m g. I had no idea who coded your website..
    And seeing this, I’m led to believe it’s ALL YOU.
    Is that possible!?  How can so much knowledge exist in one man’s head!?… besides Dexter Peterson. D:

  • SoreThumb

    O m g. I had no idea who coded your website..
    And seeing this, I’m led to believe it’s ALL YOU.
    Is that possible!?  How can so much knowledge exist in one man’s head!?… besides Dexter Peterson. D:

  • Interesting  I will be able to do this for my WordPress blogs now. ^_^!

  • NDP

    I can’t figure out how to do this using the Atahualpa theme.  What does it mean to move the tag “inside the WordPress loop?”

  • NDP

    I can’t figure out how to do this using the Atahualpa theme.  What does it mean to move the tag “inside the WordPress loop?”

  • NDP

    I can’t figure out how to do this using the Atahualpa theme.  What does it mean to move the tag “inside the WordPress loop?”

The Democratically Elected Best of Matthew Ebel Join the Robot Army, get a FREE album!

* indicates required

Enlist Today!