Orchard content sharing module arrived!

Tags: orchard, social, module, english

A nice share-bar is a must-have if you want to run your Orchard-based blog. I needed it, and so it isUśmiech In addition to the Orchard Gallery, module is also available on Codeplex, if you’d like to play with the source code.

Module delivers content sharing functionality via AddThis sharing service. I made a decision to use that instead of simply listing available social-sharing icons and links (or using Microsoft.Web.Helpers) because:

  • You get sharing analytics out-of-the-box
  • It is very easy to customize
  • I haven’t thought that there is that many sites you can share your content onUśmiech

 

Adding sharing functionality to content items

The module adds new Content Part – ShareBar, which you can add to your content types to instantly add sharing functionality. This part needs an appropriate URL to share, so it can be only applied to items, that have a RoutePart.

Unfortunately, there is no simple way in Orchard to disallow users to add this part to items without RoutePart. I’ve found a workaround to this – ShareBar just doesn’t get displayed in such scenario.

Customizing share bar look

When adding ShareBar part to your content type, you can customize how it should look like – I provided some predefined styles. You can preview them here. In the next releases I’ll provide more options for customization.

To change the appearance you just have to do:  Content Types –> choose type and click edit –> choose style in Share Bar settings (if it’s not there then you have to add ShareBar part first).

And that’s almost all!Uśmiech

Account settings

There’s one last thing you have to do after that – plug in your account to gather analytics data. You have to set your AddThis account name in Site—>Settings pane in order to make sharing bar visible.

Hope you enjoy it! Cheers!

8 Comments

  • Mark said

    I think "share bars" are right up there with the tag in the list of "irritating things on the web". End the madness!

  • pszmyd said

    @Mark: Maybe, if used improperly (lots of icons, long loading times). Could you please elaborate more on what is so irritating in sharebars? The whole social web relies on sharing and this is just a tool to ease this process. I thought about AddThis, because they allow a very compact and not-distracting display (eg. single share icon/button).

  • Russ said

    Piotr, nice module, thanks for contributing.

    Would it be possible to have more control over where the buttons go on the blog page layout however? For example, it would be nice to put them at the bottom of the post as opposed to the top,

    Keep up the good work!

  • pszmyd said

    @Russ: Yes, this can be achieved by changing the position in Placement.info file you can find under Orchard.Web/Modules/Szmyd.Orchard.Modules.Sharing.

    Just replace the line containing the shape position with or something like

    I guess there will be some GUI for that in future Orchard releases.

    HTH

  • Russ said

    @pszmyd - That'll work, thanks!

    I've also noticed that there is a script error in AddThis when running in IE6 - line 3 char 21776. It's difficult to ascertain the problem and possibly a conflict with another script in the page - I'm using only the default scripts and the Heikura Syntax Highlighting. Whilst I don't hold much admiration for IE6, I do still want to support it. There appear to be a number of issues raised on AddThis' forums about it - https://www.addthis.com/forum/viewtopic.php?f=4&t=22008

  • Russ said

    Following on from my last post, changing the # in the url to a ? as suggested in the url posted in the previous comment seems to fix the problem in IE6. If you have IE6, navigate to http://forloop.co.uk to demonstrate that it doesn't now break.

    I've tested it in IE6, Chrome 10 and Firefox 3.6 and it now works in all. Just need to test in IE 7, 8 and 9.