β

Add Social Sharing Links to your Blog without widg

Scott Hanselman's Blog 505 阅读

This sharing button thing is out of controlI'm always trying to tidy up my blog layout and remove 'noise' but every time I try to remove those social sharing buttons for Twitter and Facebook I get a barrage of email asking me to put them back. Personally, I use bookmarklets in my browser for tweeting links, rather than relying on AddThis or ShareThis or any of the other garish sharing JavaScripts.

This sharing button thing is out of control. Links work too, folks. It's the web. Let's not have our blogs turn into Vegas Billboards.*

Twitter, Facebook and Google+ all offer JavaScript that they'd LOVE for you to add to your site. Tracking is one of the reasons that they'd love you to add these. That may or may not be a strong reason not to add their JavaScript, but a concrete reason not to is speed.

When you add three services' JavaScript you're adding three DNS lookups, three (or 20) HTTP requests for their JavaScript and images, and on and on. That JavaScript has to execute as well, of course, but the value it provides isn't justified over the speed and hassle involved in my opinion.

I wanted to add social sharing links without adding JavaScript. Fortunately all these services support sharing via simply visiting a URL. Stated differently, you can share via an HTTP GET.

Below, I'm adding "YOURURLHERE" in the places you'll want the URL for your blog post. You should change these templates for your own blog engineer. WordPress, BlogSpot, DasBlog, etc all have different macro formats. Your mileage may vary.

NOTE: Make sure you check that you have the right number of quotes and ampersands when adding these to your blog template.

Twitter

Note that twitter's sharing format includes the URL, the Title and the "via" which is your twitter name.

<a href="http://feeds.hanselman.com/~/t/0/0/scotthanselman/~https://twitter.com/intent/tweet?url=YOURURLHERE&text=YOURPOSTTITLEHERE&via=YOURTWITTERNAMEHERE">Twitter</a>

Facebook

<a href="http://feeds.hanselman.com/~/t/0/0/scotthanselman/~https://facebook.com/sharer.php?u=YOURURLHERE">Facebook</a>

Google+

<a href="http://feeds.hanselman.com/~/t/0/0/scotthanselman/~https://plus.google.com/share?url=YOURURLHERE">Google+</a>

You can share THIS post by clicking the links just below here on the same line as the Comments link.

Let me know about other social sites that support this kind of sharing in the comments, and I'll add your tips to this post.

* Yes, I know I have ads on this blog. It's taco money and it pays for the gadgets I review. It's hardly Vegas.



Š 2013 Scott Hanselman. All rights reserved.
     
作者:Scott Hanselman's Blog
Scott Hanselman on Programming, User Experience, The Zen of Computers and Life in General
原文地址:Add Social Sharing Links to your Blog without widg, 感谢原作者分享。

发表评论