Skip to content

Instantly share code, notes, and snippets.

@ondrej-kvasnovsky
Last active December 18, 2015 01:08
Show Gist options
  • Save ondrej-kvasnovsky/5701094 to your computer and use it in GitHub Desktop.
Save ondrej-kvasnovsky/5701094 to your computer and use it in GitHub Desktop.
Code samples showing how to add Twitter button into a Meteor application
<template name='welcomePage'>
<a href="https://twitter.com/intent/tweet?screen_name=TemplHub"
class="twitter-mention-button"
data-related="TemplHub">
Tweet to @TemplHub
</a>
</template>
Template.welcomePage.rendered = function () {
addTwitterWidget();
}
function addTwitterWidget() {
!function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment