Social Graphs API: WordPress Plugin: Blogroll Links

If you already know what the Social Graph API and XFN are, you can skip the background information and go directly to the Blogroll Links plugin for WordPress that is designed to work with these.

Update: 2010-Feb-20: Version 2 of the Blogroll Links plugin for WordPress uses the Shortcode API and so introduces a new code-tag format. The new plugin still supports the old (now deprecated) code-tag format for backwards compatibility. See below for examples.

Social Graph API

Google recently announced the Social Graph API.1 From Google’s Code site:

With so many websites to join, users must decide where to invest significant time in adding their same connections over and over. For developers, this means it is difficult to build successful web applications that hinge upon a critical mass of users for content and interaction. With the Social Graph API, developers can now utilize public connections their users have already created in other web services. It makes information about public connections between people easily available and useful.

We (Google) currently index the public Web for XHTML Friends Network (XFN), Friend of a Friend (FOAF) markup and other publicly declared connections. By supporting open Web standards for describing connections between people, web sites can add to the social infrastructure of the web.

The Google Code site also has a video introduction to the open social graph:

YouTube Preview Image

The Google Code site has some interesting example applications. To see the power of the open social graph, follow these links:

All I did was enter my home page http://www.rajiv.com/ into these applications and got the results linked to above.

XHTML Friends Network, a component of open social networks

XFN (XHTML Friends Network) is a simple way to represent human relationships using hyperlinks. In recent years, blogs and blogrolls have become the fastest growing area of the Web. XFN enables web authors to indicate their relationship(s) to the people in their blogrolls simply by adding a ‘rel‘ attribute to their <a href> tags, e.g.:

<a href="http://www.rajiv.com/" rel="friend met">Home Page: Rajiv Pant</a>

The above link means that the page at http://www.rajiv.com/ belongs to a friend of the person who who owns the page this link is placed on. The met tag specifies that the two friends have met in real life. The link above would not be placed on a page owned by Rajiv Pant. It would be placed by a friend on their page, for example, on http://www.paradox1x.org/

Here is another example:

<a href="http://photos.rajiv.com/" rel="me">Photo Albums: Rajiv Pant</a>

This link states that the page at the URL http://photos.rajiv.com/ belongs to the same person who owns the page this link is placed on. For example, the above link would be placed on http://www.rajiv.com/ telling the Web that the URLs http://photos.rajiv.com/ and http://www.rajiv.com/belong to the same person.

To find out how to write and use XFN, or to write a program to generate or spider it, visit the XFN Web site.

Blogroll Links Plugin for WordPress

For people who maintain their Web site or blog using the WordPress blog content management system, I created an open source plugin called blogroll-links that uses WordPress’ built-in Blogroll feature2 and presents links to friends’ home pages and own pages on social networking sites using XFN in the links.

Features of this plugin

  • It can show the links by category in blog posts and WordPress Pages.
  • It uses WordPress’ standard built-in Blogroll links database. There is no hassle of another list of links to maintain.
  • It can be used to show only the links assigned to a particular category, by stating the category slug as defined in that category’s setting in WordPress.
  • It honors the Show/Hidden setting as defined for each link in WordPress.
  • It displays the link in the same window or new window, as specified for each link in WordPress.

See this plugin in action

  • http://www.rajiv.com/friends/
    • The two lists, first one of links to my own pages on various social networking sites and the second one of links to some of my friends’ pages are generated by this plugin. Yes, those social networks’ logo pictures are also taken by the plugin from the WordPress standard Blogroll links. Code:
    • <h3>My Pages on Social Networking Sites</h3>
      [blogroll-links categoryslug="rajiv-web" sortby="link_name" sortorder="desc"]
      <h3>Web Sites of Some People I Know</h3>
      [blogroll-links categoryslug="people" sortby="link_name" sortorder="desc"]
  • http://www.rajiv.com/charity/
    • This list of charitable organizations with brief descriptions is generated by the plugin. Code:
    • [blogroll-links categoryslug="charity"]
  • http://www.rajiv.com/blog/2004/08/02/search-engines/
    • This list of search engines is maintained as Blogroll links in WordPress. Code:
    • [blogroll-links categoryslug="search-engines"]
  • http://www.rajiv.com/
    • The featured links shown under the “What’s featured here?” section shows the links I’ve categorized as featured in WordPress’ Blogroll links. Code:
    • <a title="featured" name="featured"></a>
      <h2>What's featured here?</h2>
      [blogroll-links categoryslug="featured" sortby="link_name" sortorder="desc"]

Download & install plugin

  1. WikiPedia article explaining what an API, or application programming interface is. []
  2. It does not make you maintain yet another list of links []
  • http://www.fireeducator.com FireEducator

    The plug-in sounds great! Any idea when it might be available for download? I tried the WordPress Plugins Directory but could not find it yet.

    -John @ FireEducator.com

  • http://www.rajiv.com/ Rajiv Pant

    Hi John,

    It is now available via the WordPress Plugins Directory at
    http://wordpress.org/extend/plugins/blogroll-links/

    Thank you for your interest. Your feedback is welcome.

    Best regards,

  • weathervane

    Helllo, Rajiv.

    Thanks for this plugin. I’d been looking for one that would do exactly this.

    I am not a programmer, so some things get by me, and I wonder if you’d expand your plugin’s documentation. For example, when I see:

    sort-by=”link_name” sort-order=”desc”

    in your examples, I wonder what other value(s) would sort-by accept, and how do I reverse the sort-order (ascending)?

    Again, thanks for the plugin.

  • Pingback: Quick Blogroll/Links page in 1.31? - DIY Themes Forums

  • GaryO

    A couple of questions!

    1) Is there an option to have a link category open by default? If so, what is it?

    2) Is it possible to update the plugin so as the user can define how the link is displayed? As an example, rather than have the description alongside the link, have it appear on the next line. Or another example remove the list item style and substitute a heading style.

    I am quite surprised with the limited number of blogroll plugins and how some plugins over complicate the process.

    Your plugin is very functional with very little effort required to get it setup and working.

    Reagards

  • ami

    really love this plugin but was wondering what the easiest way would be to change the display from

  • to simple line breaks after each link?

    the page i'm trying to replicate is http://www.elizabethannedesigns.com/blog/links which is currently just a manual page, but would love to use this plugin instead! thank you so much!

  • ami

    never mind – was able to "fiddle with it" and found it. :) thank you for an awesome plugin!

    • http://intensedebate.com/people/rajivpant rajivpant

      Ami,

      Glad you like the plugin. Thank you for your feedback. I'll also add this as a built-in feature to a future version.

      Best wishes, — Rajiv

    • Kat

      How did you fiddle with yours. I too love the plugin but really would enjoy a way to change the display styling. Maybe a way to toggle ul and li formatting on or off within a plugin option screen would be overkill but any sort of flexibility would be a plus.

      • Ami

        hi kat! pretty sure i just edited the php file to do line breaks instead. hope this helps!

  • matt

    Is there a way to show all categories?

  • http://mariage.picturart-360.com/index.php/services/annuaire/annuaire-mariage-annuaires-generaliste/ David

    Hi, I really like your plugin.

    I would like to know if there is a way to limit the number of link display on a page and automaticaly generate a page #2, 3, 4, 5… for the extra links.

    I have a categorie with more than 300 links and I would like to display them on multiples pages…

    ps. sorry about my english, I'm french…

    Thanks for this cool plugins!

    David

  • http://intensedebate.com/people/EngineHere EngineHere

    Thanks for this plugin ! It helped me to start a custom plugin for http://www.2omg.com. Might share it with the world one day, if I can make it less application specific.
    Thanks for sharing !

  • http://kerugma.net Susan

    Thanks for a great plugin and all the work that goes into creating and maintaining it! Much appreciated.

  • ami

    hi rajiv! does the plugin accept sort-by then sort-by? ie, sort by name and then description? if so, what would the code be? thanks!

    • http://rajivpant.wordpress.com/ Rajiv Pant

      Hi Ami, It does not have a feature to sort that way yet, but it would not be difficult to add that feature. I’ll add that to the list. Thank you for using this plugin.

  • http://gadgets-and-technology.blogspot.com/ Mariskha

    Thanks for sharing.have a great day!

  • Pingback: Plugins Installed At My WP Blog « ADMARKETPRO.COM

  • lawless

    Not enough documentation on the blogroll links. Can someone post a text file of parameters and other basic configuration information?

  • http://intensedebate.com/people/tarachan tarachan

    I just upgraded this plug-in to its most recent version.

    It works fine, but when I tried to use the new code instead of the deprecated one, my links doesn't show up.

    I'm not sure why since I am not a programmer, but it's good that the old code still works, at least! Yay for backward compatibility.

    Other than that, thanks so much for making this plug-in. It does exactly what I want.

  • http://twitter.com/webduck @webduck

    I installed the plugin today 11 June 2010 but when I go to default settings they are blank. Obviously, I don't know what I'm doing. I'm not new to WP and installing plugins and adjusting settings, but this one has me stumped. I wanted to put my blogroll on a Page for my blog, but I don't know what I'm suppose to do for sure. Do I paste in the code: blogroll-links categoryslug="blogroll" (brackets omitted on purpose) into the HTML section tab? Please help me use the wonderful plugin. Thank you very much.

  • http://intensedebate.com/people/Skyflash Cristian Castellari

    Hi,
    i'm trying this good plugin, but my links page, http://www.skyflash.it/links it opens very slowly. I've tested an other plugin (that i dislike) and the page is good.

    Can you help me? Any idea?

    • http://intensedebate.com/profiles/beerbeatsbites Greg Clow

      I was having the same problem, so I went to look at the code in blogroll-links.php, and found out why it was loading so slowly.

      Here is the "Sample SQL Query" that is shown as a comment in the code:

      Sample SQL Query:
      SELECT *
      FROM wp_links, wp_term_relationships
      WHERE link_id = object_id
      AND link_visible = 'Y'
      AND term_taxonomy_id = (
      SELECT wp_term_taxonomy.term_taxonomy_id
      FROM wp_term_taxonomy
      WHERE term_id = (SELECT DISTINCT term_id
      FROM wp_terms, wp_term_relationships
      WHERE slug = 'charity'
      AND taxonomy = 'link_category'))
      ORDER BY link_name

      The fourth line from the bottom – "FROM wp_terms, wp_term_relationships" – is causing the problem. The two tables are not joined in the WHERE clause below that, and there is no reason for wp_term_relationships to be there at all – having it there just causes full table scans to take place that aren't necessary.

      Of course, this is just the comment part of the code, so it's the actual PHP code below this that needs to be modified. I edited this line…

      "FROM " . $table_prefix . "terms, " . $table_prefix . "term_relationships " .

      …and changed it to this…

      "FROM " . $table_prefix . "terms " .

      …and now my Links page – http://www.beerandbuttertarts.com/sources/ – opens in a split second.

      Luckily, I'm familiar with SQL and PHP, so I was able to find & fix this. Most users of the plug-in probably aren't, though, so hopefully an update will be released, as it's a very simple fix.

  • http://www.organiclightphoto.com Youssef Ismail

    Hello Rajiv

    I have been trying to find a plugin for WP that would allow me to display the links in my blogroll onto my pages. I found two that seem to work, yours and one called Link Library. Link Library is complicated and does not format the information well.

    Your plugin is much simpler and the output format is much cleaner. I do have one request if you can direct me on how to implement this, your plugin would be perfect.

    The website being built in WP is informational in nature. http://www.earlyadvantagebirth.com. I have several dozen pages that I have set up to display only the links to providers on each specific page. When I set up the link, I don't use the description section, but rather the notes in the Advanced section of the add new links admin page. I want to display that notes information with the link. How would I do that?

    You can contact me at [email protected]

    Thanks

  • http://www.clothunderground.com justbishop

    Anyone discovered some variable list or something for this plug? I've tried using both sortorder="random" and sortorder="rand" in the shortcode, but neither work.

    Also, no matter what I put into the text fields in the settings, when I save, they're blank again. I'm running WP 3.0 in multisite mode.

  • http://twitter.com/ArlenWilliams @ArlenWilliams

    Is this all private information, or does Google grab it for whatever use it has?

  • Pingback: Better Blogroll Links | Sciamanna blogga

  • cambioclimatico

    Hi, great plugin – how do I order the links by date added?

    • petufo

      Sort by ID

  • petufo

    I have a problem – the "sortorder" parameter doesn't work. I need to sort links by ID (it's ok) – descending. But [... sortorder="desc"] does nothing… :-/ Pls help. (WP version 3.0.3)

  • http://pulse.yahoo.com/_OAZ25BMPKU2WUUUE2WW3L2PDAI zmi

    I have been trying to find a plugin for WP that would allow me to display the links in my blogroll onto my pages.

  • http://pulse.yahoo.com/_OAZ25BMPKU2WUUUE2WW3L2PDAI zmi

    I have been trying to find a plugin for WP that would allow me to display the links in my blogroll onto my pages.
    baboon.ir

  • Pingback: wordpress plugin review and discussion. | Loadwp.com

  • Anonymous

    Excellent information. I have pointed my readers to it in my article about the Blogroll and Links.
    Thank you for your help.

    Andy Moore

  • Anonymous

    I would like to know if it is possible to replace the category name of the links with a photo?