Share via Diaspora* and service_links

Diaspora* is a popular non-proprietary, federated social network. Instead of everyone’s data being contained on huge central servers owned by a large corporation, local servers (“pods”) can be set up anywhere in the world. These servers are then federated, so that they talk to each other. This decentralised structure poses some challenges to the implementation of a "share via Diaspora*" button in 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 about adding custom services on the Service Links page at, but here are some brief instructions specific to Diaspora*.

Service Links maintains a lot of sub-modules in a folder called services. However, adding a sub-folder in the module folder is not a good idea as your additional service will disappear when you update the Service links module, either manually or via Drush. Instead you should create your own module in a separate folder, which will survive any update of Service links

In your modules folder (probably /sites/all/modules) create a new folder diaspora_service.

First we need the module info file - containing the essential information about the new module:

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 a .png, and that file - in our example named diaspora.png - should be placed in the images folder of the Service Links module, or, better still, in a folder you configured in Service links, so that your images do not disappear when you update Service links itself.

That's all that's needed to add Diaspora* to Service Links.

Under the hood

The clever bit was done by Bartimeo*, who created the Diaspora* Advanced Sharer. This module makes use of that work to pass 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. You can then share the content. As with similar content sharing opportunities, you will be prompted to login to Diaspora* if you are not already.