Skip to content

Instantly share code, notes, and snippets.

@chrisjlee
Last active March 25, 2024 05:39
Show Gist options
  • Save chrisjlee/5196139 to your computer and use it in GitHub Desktop.
Save chrisjlee/5196139 to your computer and use it in GitHub Desktop.
share url's for facebook, twitter, pinterest with just get variables
<ul>
<li class="share-text">Share this>/li>
<li class="share-tw"><a href="http://twitter.com/share?text=[title]"><span></span></a></li>
<li class="share-fb"><a href="http://www.facebook.com/sharer.php?u=/node/[nid]&p=[title]"><span></span></a></li>
<li class="share-pinterest"><a href="http://pinterest.com/pin/create/button/?url=/node/[nid]&description=[title]"><span></span></a></li>
</ul>

Creating share buttons with just URL's

Twitter

http://twitter.com/share?text=<TITLE>&url=<URL>

E.g. http://twitter.com/share?text=This+is+google+a+search+engine&url=https%3A%2F%2Fwww.google.com

Facebook

http://www.facebook.com/sharer.php?u=<URL>&p[title]=<TITLE>

E.g. http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.google.com%[title]=This+Is%2C+Google+a+search+engine

Pinterest

http://pinterest.com/pin/create/button/?url=<URL>&description=<TITLE>

E.g http://pinterest.com/pin/create/button/?url=https%3A%2F%2Fwww.google.com&description=This+is+google+a+search+engine

@thejamesjones
Copy link

Thought I would add the url for Linkedin. I just deployed this on my blog and works beautifully.

Linkedin

http://www.linkedin.com/shareArticle?mini=true&url=[path]&title=[title]&summary=[description]&source=[domain]

More info here: https://developer.linkedin.com/documents/share-linkedin

@surface2air
Copy link

How can you attach an image using the share link example for Pinterest?

@anushakusam
Copy link

@surface2air Add &media=[Image URL]

@charliebutler
Copy link

Twitter are using Tweet Web Intent now.

Share? will still redirect automatically, but if you want to set up the URL, it'd look something like this:

https://twitter.com/intent/tweet?text=This%20is%20google%20a%20search%20engine&hashtags=searchengine,google&url=https%3A%2F%2Fwww.google.com&via=google

https://dev.twitter.com/web/tweet-button/web-intent

@johnholtripley
Copy link

@surface2air It looks as if you can add &media={image URL} and this will pass the image you want

@moizmala
Copy link

Can anyone sharer link for instagram post ?

@callard
Copy link

callard commented Apr 4, 2016

In case some you want to share on Linked In :
https://developer.linkedin.com/docs/share-on-linkedin

@undersound
Copy link

undersound commented May 15, 2016

Missing a closing tag on the first li
http://pastebin.com/XVK69cEF

@Naboum
Copy link

Naboum commented Jun 6, 2016

Apparently Instagram doesn't allow to upload images through their API

@tysonchamp
Copy link

image pin it button: my code <a class="info" target="_blank" data-pin-do="buttonPin" href="https://www.pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php echo $image[0]; ?>&description=<?php the_title(); ?>" data-pin-custom="true"><i class="fa fa-pinterest"></i></a>

@atb-docaocuong
Copy link

How about Line ?

@AngosStudio
Copy link

Instagram have something like Facebook Sharer link?!

@usamamashkoor
Copy link

@AngosStudio did you find anything for Instagram share..?!

@luukskeur
Copy link

Mail share
mailto:?subject=[title]&amp;body=[URL]

@OliverJAsh
Copy link

Pinterest doesn't seem to honour the provided description unless you also provide a media.

@lalit121
Copy link

lalit121 commented Dec 16, 2017

example "a class="twitter-share-button" href="https://twitter.com/intent/tweet?url=https://www.example.com&text=Hello"
How to Add Image url in this Twitter Share Button ??
Please Replay me !

@ykoken
Copy link

ykoken commented Jan 31, 2018

instagram ?

@enriquesoto
Copy link

instagram?

@vickymcc
Copy link

talk about instagram

@MBK8303
Copy link

MBK8303 commented Jun 13, 2018

How we can get response in Asp.Net Application from Facebook, LinkedIn and other social media platform when we share content from Asp.Net that content upload successfully or not.

@m-aluya
Copy link

m-aluya commented Aug 28, 2018

@Ahmadkhan12345566
Copy link

Ahmadkhan12345566 commented Feb 24, 2021

Facebook
http://www.facebook.com/sharer.php?u=&p[title]=<TITLE>

E.g. http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.google.com%[title]=This+Is%2C+Google+a+search+engine

http://www.facebook.com/sharer.php?u=myurl.com&p[title]=testtile

url working fine
title not working
This url used to accept Parameters such as title and description, but they are no longer supported and should not be used.

@brandonhill
Copy link

brandonhill commented Jan 12, 2022

@Ahmadkhan12345566 title is sourced from og:title meta, but you can supply custom a text snippet with quote, e.g.:

...sharer.php?u=myurl.com&quote=Lorem%20ipsum

You can see what the title will be using the share debug tool: https://developers.facebook.com/tools/debug/?q=myurl.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment