How to add the social sites under every blog post?

Topics: Customizing Orchard, General, Installing Orchard
Feb 21, 2013 at 12:52 PM
Hi,
Can you please let me know how to add the social media icon for each blog post with corresponding link?

For EX:
Post1:Sample
Sample Message
Twitter Icon Facebook Icon
Post2:Sample
Sample Message
Twitter Icon Facebook Icon
Developer
Feb 21, 2013 at 8:34 PM
You could attach a SocialPart to the BlogPost type.
Then, in the view for that SocialPart, you render the icons and links as desired.
Feb 22, 2013 at 4:29 PM
An easier alternative to adding a SocialPart would be to create a layer that specifically targets only blog posts and then add a quick HTML widget with all the links to your social networking websites. Place the widget in perhaps an "AfterContent" Zone so it comes at the end of the blog post.

You could either use the url rule in your Layer Rule and specify a url that only targets blog posts. An example may look like:

url("~/blog/*")

Or, if you are comfortable in the Orchard Source code, grab the code for the new contenttype rule that will be available in Orchard 1.7. Here is a blog post on the new Content Type Layer Rule:

Orchard Content Type Layer Rule


There are lots of ways to solve this problem, but I think a Layer is the easiest, especially if you are not familiar with development in Orchard.

Regards,

Dave
Developer
Feb 25, 2013 at 10:11 AM
I was under the assumption that the question was about how to do it for a list of Posts, with the ability to share / tweet each individual Post.
But for a Post details page with simple links to the social websites, adding a layer is absolutely a good option.
Feb 27, 2013 at 5:29 AM
Hi,
Can you please let me know how to add the layer to display the social icons under each blog post?
Coordinator
Feb 27, 2013 at 5:50 AM
Not a layer. As he told you, you should add a part that takes care of that. Make your own or use one that's available on the gallery, such as AddThis.