Direct social sharing URLs

There are cases when you don't want to add some plugin to your blog or to the website you're building simply to have social sharing links on your site.

You might also want to be in full control of your design.

In cases like these it's hand to have a set of commonly used social links.

So, here hey are.

Facebook

https://www.facebook.com/sharer/sharer.php?u={siteUrl}

Twitter

https://twitter.com/intent/tweet?url={siteUrl}&via=DomagojSalopek&text={socialTitle}

Documentation

Google Plus

https://plus.google.com/share?url={siteUrl}

Documentation

Linked In

https://www.linkedin.com/cws/share?url=@fullUrl

Pinterest

https://pinterest.com/pin/create/bookmarklet/?media={socialImage}&url={siteUrl}&is_video=false&description={socialTitle}

Please note that the best practice is to include open graph protocol tags on the details of the page you're planning to share, because most social media sites know how to read and use those tags to display description and image when sharing content.

Here's an example taken from The Open Graph protocol page:

<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
...
</head>
...
</html>

That's it for this post, thanks for visiting and feel free to share.

Comments are closed