Skip to content

Instantly share code, notes, and snippets.

@maxfenton
Created November 5, 2013 21:35
Show Gist options
  • Select an option

  • Save maxfenton/82a9843ceac7fa0a7493 to your computer and use it in GitHub Desktop.

Select an option

Save maxfenton/82a9843ceac7fa0a7493 to your computer and use it in GitHub Desktop.
Unofficial twitter API
<footer class='article-footer'>
{% if current.meta.footer %}{{ current.meta.footer | md }}{% endif %}
{% capture tweet_text %}I thoroughly enjoyed this post > "{{ current.title }}":{% endcapture %}
<a class='tweet-button' href='https://twitter.com/intent/tweet?original_referer={{ current.permalink | escape }}&text={{ tweet_text | escape }}&tw_p=tweetbutton&url={{ current.permalink | escape }}&via={{ site.meta.twitter }}' target='_blank'><span class='ss-icon ss-social-regular'>twitter</span><span id='twitter-count' class='count'></span></a>
<script>
function count_callback(data) { document.getElementById('twitter-count').innerHTML = data.count; }
var script = document.createElement('script');
script.setAttribute("src", 'http://urls.api.twitter.com/1/urls/count.json?callback=count_callback&url={{ current.permalink | escape }}');
document.getElementsByTagName("head")[0].appendChild(script);
</script>
</footer>
@maxfenton
Copy link
Copy Markdown
Author

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