Social Share for Sitefinity News List Items

April 15, 2013 Digital Experience

When using the News module in Sitefinity CMS, one requirement is to be able to share a news item directly from the news list on the frontend. That way, users who find an item interesting by just reading the summary can easily share a link to the whole news item.

This can be achieved by creating a user control, for the template use the template of the list view, extend it via the codebehind to accommodate our requirement.

By default the template contains the social share placeholder container:  <asp:PlaceHolder ID="socialOptionsContainer" runat="server" />

First we need to hook to NewsList_ItemDatabound. After that we have access to all the information to successfully populate the social share information. We need a Title and a URL to share. The URL we share will be the one from the DetailsViewHyperlink. That way when a user on Facebook clicks it, they will be taken to the full news story.

Once we have all the necessary information, we create a new RadSocialShare and add the Title and Link to share.

Once we are done, all we need to do is place a News widget on the page and replace the NewsList template by clicking on Edit -> Advanced->ControlDefinition->Views->NewsFrontendList and in TemplatePath add the path to our modified template:



If everything is working, the end result will be this:



Here is the sample, ready for use and customization: NewsSocialShare

The Progress Team