Twitter Share Button

Add Twitter share button to your Jekyll template.

Set Twitter username in Jekyll config file _config.yml:

author.twitter: ivanchromjak

Create _includes/share.html file:

<div class="share">
  Share this on &rarr;
  <a class="twitter" href="https://twitter.com/intent/tweet?text={{ page.title }}&url={{ site.url }}{{ page.url }}&via={{ site.author.twitter }}&related={{ site.author.twitter }}" rel="nofollow" target="_blank" title="Share on Twitter"><span class="icon icon--twitter">{% include icon-twitter.svg %}</span> Twitter</a>
</div>

Include the share.html in post layout file _layouts/post.html:

{% include share.html %}