Feb
10
2011

Append A URL Link In Your Post’s Excerpt RSS Feed

Alter your Wordpress feed (if you're using excerpts) to add a link to the end of your RSS content. The benefits extend to improving user interface (in getting to your site) and have a potential SEO impact.

Share
Email

Why

My initial reason for doing this was in the fact that Facebook (when importing your posts to your wall automatically) does not link to your original post if you’re only providing an excerpt.

How To Aggregate WordPress Posts To Your Facebook Page

If you’re not already aggregating your WordPress blog onto a Facebook page, its a good idea to do so. That is if you’re looking for an easy way to extend your posting efforts through a little marketing. See this post for the how to: How to Import Blog Feed to Facebook Pages

Facebook Display Issues

After doing what the article at ridhuan.com outlined I was somewhat frustrated at the output format on Facebook. You can’t easily get to my full post because Facebook is replacing the title with regular text instead of a Feedburner pseudo link to my post on robmalon.com. First, the post it made on my wall looked like this

Facebook Imported Feed Link On Wall

Facebook Imported Feed Link On Wall

Where you would think the link at the top of that excerpt would go to (or at least 301 through Feedburner) my original post, it instead went to:

http://www.facebook.com/notes/rob-malon/moving-a-wordpress-database-between-live-development-staging-environments/162516347100039

Sorry to say, there really is no good way around this part.

However, when you go in through that first link you’ll see what would be the “Full” post if I wasn’t just providing the excerpt on my end through WordPress. On this page it simply repeats my excerpt and contains a “view original” link leading to:

http://feedproxy.google.com/~r/robmalon/~3/92Q13LtE5_c/

This link does in fact go to my original post. But its not in an obvious spot. What I wanted was my link (highlighted in pink below) in that view as well:

Facebook Imported Feed Page

Facebook Imported Feed Page

WordPress Filter – A Fix

To get that, you can add a quick snippit of code to your functions.php file within your current theme’s folder.

function feed_excerpts_append_link($output) {
 global $post;
 if (is_feed() && get_option('rss_use_excerpt') ) {
 return $output . ' <a href="'. get_permalink() . '">' . get_the_title() . '</a>';
 }
}
add_filter('get_the_excerpt', 'feed_excerpts_append_link');

From now on, when posts get aggregated to Facebook or pulled from your feed burner feed you’ll now see the link on the end of your excerpt. Note it won’t correct anything that’s already been pulled into other systems (like Facebook). See how this gets displayed in Google Reader:

Google Reader Display And URLs

Google Reader Display And URLs

In case you were wondering, yes get_the_excerpt is depreciated by the_excerpt which will NOT work. Technically we should be modifying excerpt_more here but because the official bug on this has not been resolved (at the time of doing this for my own sites http://core.trac.wordpress.org/ticket/13361) it is the best that can be done with the latest version of WordPress (3.0.x).

Google Reader

Google reader properly pulls the title with a link back to the original post in the way your feed provides it:

http://feedproxy.google.com/~r/robmalon/~3/92Q13LtE5_c/

Along with the real URL at the end of the excerpt. The only downside I see to this is that it might skew some of your tracking that Feedburner supplies since you’re not going through Feedburner’s URL. If its more intuitive there and gets clicked when someone might have not clicked through, traffic is traffic. Test this out and see if it starts netting you more.

Final Implications

  • User Interface – The obvious thing we were going for to begin with was to have an quicker and more obvious way to get to the original post.
  • SEO – Again, assuming you’re using Feedburner (as many do) your title URL is being rewritten with Feedburner’s URL. When its not forcefully unlinked/cleared by Facebook. Hence, no link juice for you if your feed gets scrapped onto someone elses site. But now, if a scraper comes by and wants to throw your excerpt on their site you now get a proper link back to your site.

Despite the potential drawbacks with Feedburner tracking, this could make it really worth while to put this into practice. It somewhat depends how often you notice yourself being scraped. I actually switched to excerpts because I was tired of tracking down my scraped content. That’s an argument in itself we won’t get into here.?

Respond: Leave A Comment | Trackback URL

Entrupeners, Subscribe for the lastest tools, tips, and tutorials.


3 Responses to Append A URL Link In Your Post’s Excerpt RSS Feed

  1. Hi Rob,

    Thanks for referring my blog here but the one you checked was an old post. Check my 2 latest post and you might be interested to try them.

  2. Check to see that you’re not using a rss feed that’s doing a 301. It doesn’t like those. Your old instructions for the URL I referenced still work for me.

  3. HI, you could try this filter instead :

    add_filter(‘the_excerpt_rss’, ‘feed_excerpts_append_link’);

    and remove the is_feed() from your conditional.

    cheers,
    serge

Leave a Reply

Custom Theme by Rob Malon | Content & Design © 2010 - RobMalon.Com - Chicago, Illinois