The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
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:
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
You have the right to request deletion of your Personal Information at any time.
You can also ask us not to pass your Personal Information to third parties here: Do Not Sell My Info
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Copyright © 2021 Progress Software Corporation and/or its subsidiaries or affiliates.All Rights Reserved.
Progress, Telerik, Ipswitch, Chef and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.