any way to add social media links to share in blog posts in 2.8 version?

Topics: Themes
Jul 24, 2013 at 2:55 AM
any way to add social media links to share in blog posts in 2.8 version?

Like addthis or facebook/twitter share links for blog posts ?
Developer
Jul 24, 2013 at 9:58 PM
Hi,
You must edit theme. example in standard theme blogengine 2.8
  1. Go to this file and edit it: /themes/standard/postview.ascx
  2. Paste your codes after into: <%=AdminLinks %>
  3. save this file and refresh your blog.
    Done.
Feb 7, 2014 at 8:30 PM
I did that, however, the addthis code displays on themain blog page on each post with numbers that do not relate to the post. Ideas?
Feb 9, 2014 at 11:34 PM
Hi Pepper,

It might be better, faster loading speed not to use the addthis or other extensions but instead use this method
(Till some one creates an extension using this method):
  1. Social Sharing Links
http://www.paulund.co.uk/social-sharing-links
  1. CSS Social Media Icons
http://medialoot.com/item/css-social-media-buttons/

Here is an example for you for Twitter:
  1. Use the CSS from MediaLoot link above.
  2. Put this code in your /themes/standard/postview.ascx file
<a target="_blank" href="https://twitter.com/intent/tweet?text=OUR-TITLE&url=YOUR-URL&via=TWITTER-HANDLE" class="twitter">Tweet This</a>

BE Code

<a target="_blank" href="https://twitter.com/intent/tweet?text=<%=Server.HtmlEncode(Post.Title) %>&url=<%=Post.RelativeOrAbsoluteLink %>&via=TWITTER-HANDLE" class="btn-twitter">Tweet This</a>

For Title Use: <%=Server.HtmlEncode(Post.Title) %>
URL to Post: <%=Post.RelativeOrAbsoluteLink %>

Now you do the same with the other social media buttons :)

This way you are not having server requests to each social media provider for JavaScript and Image files.

You also don't use any images just pure "CSS" so you can customize it exactly how you want it to appear.

If you must have the counts show up :)

You can write some script that counts each successful "action" and then use something like

<%=Social.TwitterCount%> to inject those counts for you.


So could have it like this:

<a target="_blank" href="https://twitter.com/intent/tweet?text=__<%=Server.HtmlEncode(Post.Title) %>&url=<%=Post.RelativeOrAbsoluteLink %>__&via=TWITTER-HANDLE" class="btn-twitter">Tweet This</a> <div id="twittercount"><%=Social.TwitterCount%> </div>

Then have CSS for your counter.

You can even go even further with HTML5 data attributes

http://html5doctor.com/html5-custom-data-attributes



Hope this helps.

Brian Davis
http://bloggersOnline.com
Feb 10, 2014 at 12:04 AM
I'm with Brian on that one.

Facebook ‘Like’ button: 270Kb
Google+ Share button: 135Kb
Twitter Share button: 95Kb
LinkedIn Share button: 80Kb

Want all four? That’ll be 580Kb, please — or more than 10 seconds on a good mobile connection.

From The Hidden Cost of Social Sharing

If leaving the page is a concern, the follow up post shows how to open links in pop ups.
How to Add Fat-Free Social Buttons to Your Pages
Feb 10, 2014 at 1:15 AM
Hi All,

Even better since BE 2.8 and higher is using BootStrap can use the alert in a div.


<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<a target="twitter" href="https://twitter.com/intent/tweet?text=__<%=Server.HtmlEncode(Post.Title) %>&url=<%=Post.RelativeOrAbsoluteLink %>__&via=TWITTER-HANDLE" class="btn-twitter">Tweet This</a> <div id="twittercount"><%=Social.TwitterCount%> </div>
<div id="twitter" class="alert alert-warning alert-dismissable"> </div> No pop-up window!

I will try this out soon to see how it works :)