How-to: Adding Diaspora* as a service for Drupal service links

Drupal's Service Links module is a great and simple way to add share services to your Drupal website. But it lacks support for Diaspora* or other free and decentralised social networks, which is a pity for those of us who use them.

This example makes use of the Diaspora* Advanced Sharer developed by Bartimeo* to add a Diaspora* share button to service links.

Adding services to Service Links

There is a very detailed explanation on the Service Links page at, so there is in theory no need for this page. Nevertheless, here are some instructions.

Service Links maintains a lot of sub-modules in a folder called services. In this folder, we will create a new sub-module called diaspora_service.

First we need the module info file -

name = Diaspora* service
description = Provide a share link for sharing on Diaspora* pods
core = 7.x
package = Service Links - Services
dependencies[] = service_links

The second file we need is the module file itself - diaspora_service.module:


 * @file
 * Extends Service Links with Diaspora* services.
 * @author andreasspeck

 * Implements hook_service_links().
function diaspora_service_service_links() {
  $links = array();

  $links['diaspora'] = array(
    'name' => 'Diaspora*',
    'description' => t('Share on Diaspora*'),
    'link' => '<encoded-title>&url=<encoded-url>',

  return $links;

And then we need a Diaspora* image, which will appear as the image of the service. You can probably grab one from Diaspora* itself. I converted the Diaspora* favicon to png, and that files goes - named diaspora.png - in the images folder of the Service Links module.

That's all that's needed to add Diaspora* to Service Links. Pretty simple. But you can also download the files attached to this How-to.

What does this actually do?

The clever bit was done by Bartimeo*, who did set up the Diaspora* Advanced Sharer. This module makes use of it, and passes the URL and page title to the Diaspora* Advanced Sharer, which then allows you to select a Diaspora pod from a prepopulated list or add your own pod, if it is not on the list. Then you continue to share what you wanted to share - provided you are already logged into you Diaspora* pod. If not, you will be asked to login, and then can share the post.