Better buttons for social media sharing
28 May 2018
Do your bit to help keep the World Wide Web tidy.
The share buttons provided by the big social media platforms make it easy for your visitors to post a link to your site, but they also gum up the web with extra HTTP requests and hidden tracking cookies. The code snippets below make use of simple hyperlinks to power share buttons instead. This is better for load times and better for your visitors’ privacy too.
Don’t forget to URL encode the links you want to share, and add
target="_blank" if you want the dialogs to open in a new window.
<a href="https://www.facebook.com/sharer/sharer.php?u=URL">Share on Facebook</a>
<a href="https://twitter.com/intent/tweet?url=URL">Share on Twitter</a>
<a href="https://www.linkedin.com/shareArticle?mini=true&url=URL">Share on LinkedIn</a>
Also accepts the
summary parameters, though this info will be also be picked up automatically from your page’s Open Graph tags. More info here.
- 12 Jun 2018 →
How did adverts get so good at following us around?