Skip to content

Instantly share code, notes, and snippets.

@allanwhite
Last active May 6, 2024 05:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allanwhite/cc4943aa5122ba5257ae to your computer and use it in GitHub Desktop.
Save allanwhite/cc4943aa5122ba5257ae to your computer and use it in GitHub Desktop.
Lean Share Icons (a partial for Statamic CMS)
<h2 class="subhead">Share this!</h2>
<p class="icons"><!-- there's some styling for icons here; lots of ways to solve this. See font-awesome for icons -->
<a href="https://twitter.com/intent/tweet?text={{ site_name }}: {{ title|truncate:100 }}&url={{ permalink }}&related={{ twitteruser }}" target="_blank"><i class="icon-twitter"></i> </a>
<a href="http://www.facebook.com/sharer.php?s=100
&p[url]={{ permalink }}
{{ if image_featured_thumb }}&p[images][0]={{ image_featured_thumb }}{{ endif }}
&p[title]={{ site_name }}: {{ title }}
&p[summary]={{ summary|truncate:200 }}"><i class="icon-facebook"></i> </a>
<a href="https://plus.google.com/share?url={{ permalink }}"><i class="icon-google-plus"></i></a>
<a href="http://www.linkedin.com/shareArticle?mini=true&url={{ permalink }}&title={{ title }}|{{ site_name }}&summary={{ summary|truncate:100 }}" title="_blank"><i class="icon-linkedin"></i> </a>
<a href="mailto:?to=&subject={{ title }} | {{ site_name }}&body={{ permalink }}" title="Email this page to a friend"><i class="icon-envelope"></i></a>
</p>
@allanwhite
Copy link
Author

Basic, lightweight, configurable share URLS for Facebook, Twitter, G+, LinkedIn, and email. This code was composed in 2013, so check against these services for any URL-structure updates.

@pmeissner
Copy link

Thanks for sharing this. Just had to tweak a few things. Most notably the facebook sharer.php has deprecated the passing of images and summaries in favor of opengraph.

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