Skip to content

Instantly share code, notes, and snippets.

@chrisjlee
Last active April 23, 2024 04:07
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

@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

@KiddAu
Copy link

KiddAu commented Apr 23, 2024

For facebook, quote parameter is not working anymore, can use hashtag instead

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