Skip to content

Instantly share code, notes, and snippets.

@benschwarz
Created August 31, 2012 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benschwarz/3548806 to your computer and use it in GitHub Desktop.
Save benschwarz/3548806 to your computer and use it in GitHub Desktop.
BYO tumblr.
<script id="article-template" type="text/template">
<article>
<h1 class="title"></h1>
<time class="publishedDate"></time>
<div class="content"></div>
</article>
</script>
<div id="blog">Loading</div>
<script src="js/plates.js"></script>
<script src="http://www.google.com/jsapi"></script>
<script>
(function () {
var feedURL = "http://abbyseymour.tumblr.com/rss",
postsPerPage = 10,
blogContainer = document.getElementById( 'blog' ),
articleTemplate = document.getElementById( 'article-template' ).innerHTML,
init = function () {
var feed = new google.feeds.Feed( feedURL );
feed.setNumEntries( postsPerPage );
feed.load( insertPosts );
},
insertPosts = function ( response ) {
var entries = response.feed.entries,
fragment = Plates.bind( articleTemplate, entries );
blogContainer.innerHTML = fragment;
};
google.load( 'feeds', '1' );
google.setOnLoadCallback( init );
}())
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment