Fully Valid, SEO-Friendly Social Media Links for WordPress

[ ~{*}~ ] With the explosion of social media, networking, and bookmarking services, there are a zillion ways to add “Share This Post” functionality to your WordPress-powered sites. In addition to the myriad services and plugins, we can also add these links directly, using nothing more than a little markup and a few choice PHP snippets. Such individual links provide full control over the selection, layout, and styling of each link without requiring the installation of yet another WordPress plugin.

This article shares SEO-friendly code snippets for ten of the most popular social media sites using completely valid XHMTL-Strict markup. All of the following code snippets feature:

  • nofollow attributes to conserve pagerank
  • descriptive title attributes for every link
  • encoded ampersands via & characters to keep ‘em valid
  • WordPress template tags for dynamic permalink and title generation
  • PHP’s urlencode() function to encode titles for valid code

Everything here is 100% copy-&-paste, plug-n-play, and ready to go! No editing required! Simply add this code to the desired location in your markup and enjoy! :)

Delicious

Here we have two code snippets for Delicious: the first enables users to bookmark your posts, while the other searches Delicious for links:

<a rel="nofollow" href="http://delicious.com/post?url=<?php the_permalink(); ?>&amp;title=<?php echo urlencode(get_the_title($id)); ?>" title="Bookmark this post at Delicious">Bookmark at Delicious</a>
<a rel="nofollow" href="http://del.icio.us/url?v=1&amp;url=<?php the_permalink(); ?>" title="See all Delicious links to this post">Check Delicious Links</a>

Digg

Ahh, where would we be without Digg.. Here is the code to add a “Digg This!” link to your WordPress posts:

<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=<?php the_permalink(); ?>" title="Submit this post to Digg">Digg this!</a>

Twitter

Here is a “quick-and-dirty” way to enable visitors to easily and quickly tweet your posts with a single click:

<a rel="nofollow" href="http://twitter.com/home?status=<?php echo urlencode("Currently reading: "); ?><?php the_permalink(); ?>" title="Share this article with your Twitter followers">Tweet this!</a>

StumbleUpon

Everyone loves StumbleUpon; they are great for short, intense bursts of decent-quality traffic. Here are two different code techniques to enable your readers to submit your posts to StumbleUpon:

<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php echo urlencode(get_the_title($id)); ?>" title="Share this post at StumbleUpon">Stumble this!</a>
<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php _e(urlencode(the_title('','',false))); ?>" title="Share this post at StumbleUpon">Stumble this!</a>

Technorati

Although you can’t really add or share individual posts at Technorati, it is possible to “favorite” entire blogs or even search for content that may be similar to yours. Here is the code to enable visitors to easily add your site to their favorites list at Technorati:

<a rel="nofollow" href="http://technorati.com/faves?add=<?php bloginfo('url'); ?>" title="Add <?php bloginfo('name'); ?> to your Technorati favorites">Add <?php bloginfo('name'); ?> to your Technorati favorites</a>

Here are two different ways to go about searching for similar content, the first uses the post title for the search query, while the other uses the permalink of the post:

<a rel="nofollow" href="http://technorati.com/cosmos/search.html?url=<?php echo urlencode(get_the_title($id)); ?>" title="Search for similar posts on Technorati">Similar Technorati Content</a>
<a rel="nofollow" href="http://technorati.com/cosmos/search.html?url=<?php the_permalink(); ?>" title="Search for similar posts on Technorati">Similar Technorati Content</a>

Facebook

It seems like all of my non-geek friends and relatives have managed to find me on Facebook. Here’s a way to let them share your posts with each other:

<a rel="nofollow" href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&amp;t=<?php echo urlencode(get_the_title($id)); ?>" title="Share this post on Facebook">Share on Facebook</a>

Blinklist

Blinklist is another popular social bookmarking site that may also serve you well. Here is how to add a “Blink This!” link to your posts:

<a rel="nofollow" href="http://blinklist.com/index.php?Action=Blink/addblink.php&amp;url=<?php the_permalink(); ?>&amp;Title=<?php echo urlencode(get_the_title($id)); ?>" title="Share this post on Blinklist" >Blink This!</a>

Furl

Yet another social bookmarking site, Furl is another potentially useful service that may return a few clicks. Here is teh majiik code:

<a rel="nofollow" href="http://furl.net/storeIt.jsp?t=<?php echo urlencode(get_the_title($id)); ?>&amp;u=<?php the_permalink(); ?>" title="Share this post on Furl">Furl This!</a>

Reddit

And of course, we can’t forget Reddit, a social linking site that is very popular among certain circles. Here’s how to get in on the action:

<a rel="nofollow" href="http://reddit.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php echo urlencode(get_the_title($id)); ?>" title="Share this post on Reddit">Share on Reddit</a>

AddThis

AddThis.com is a popular service that enables users to easily add your posts to a zillion different social sites. Once you have an account, change “USERNAME” in the code below and use the link as a fallback for your readers to share your site with the obscure site of their choice:

<a rel="nofollow" href="http://www.addthis.com/bookmark.php?pub=USERNAME&amp;url=<?php echo get_permalink(); ?>&amp;title=<?php echo urlencode(get_the_title($id)); ?>" title="Bookmark this article at your favorite social media site">Share this post at your favorite social media site</a>

Got More?

While we’re on the subject, what are your favorite social media sites? Did I cover all the most popular sites, or are there others that should be added to this post? Either way, by extrapolating the techniques used in this article, you can add a custom “Share This” link for just about any of your favorite social media services.

{ Hard to believe it’s almost December.. }

More Information