Skip to content

Instantly share code, notes, and snippets.

@iamandrewpeters
Created January 30, 2020 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamandrewpeters/83d2c84054d0a4df926316764fcd6c68 to your computer and use it in GitHub Desktop.
Save iamandrewpeters/83d2c84054d0a4df926316764fcd6c68 to your computer and use it in GitHub Desktop.
Social Sharing with Twig
/* Colors for the icons */
.fa-facebook-square {
color: #378997;
}
.fa-twitter {
color: #EF6832;
}
.fa-envelope-open {
color: #44B3E3;
}
/* Sizing and a bit od padding for the icons */
.all-social-share-links .fab, .all-social-share-links .fas {
font-size: 40px;
padding-right: 10px;
}
/* Hover color for the icons and a bit of rotation */
.fab:hover, .fas:hover {
color: #D950B3;
transform: rotate(-2deg);
}
<span class="before-share-text">Share This</span>
<span class="all-social-share-links">
<a class="social-links social-links-link-facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ post.link|e('url') }}&t={{ post.title|e('url') }}" title="Share on Facebook" target="_blank" onclick="window.open(this.href,'social-share','left=20,top=20,width=500,height=500,toolbar=1,resizable=0');return false;">
<i class="fab fa-facebook-square"></i>
</a>
<a class="social-links social-links-link-twitter" href="https://twitter.com/intent/tweet?source={{ post.link|e('url') }}&text={{ post.title|e('url') }}:{{ post.link|e('url') }}" target="_blank" onclick="window.open(this.href,'social-share','left=20,top=20,width=500,height=500,toolbar=1,resizable=0');return false;" title="Tweet">
<i class="fab fa-twitter"></i>
</a>
<a class="social-links social-links-link-email" href="mailto:?subject=Check%20out%20this%20post%20about%20{{ post.title|e('url') }}&body=Here%20is%20the%20story%20:%20{{ post.title|e('url') }}:%20{{ post.link|e('url') }}" target="_blank" onclick="window.open(this.href,'social-share','left=20,top=20,width=500,height=500,toolbar=1,resizable=0');return false;" title="Send email">
<i class="fas fa-envelope-open"></i>
</a>
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment