Created
April 7, 2010 05:13
-
-
Save btrott/358553 to your computer and use it in GitHub Desktop.
Sample code for embedding TypePad blog posts in a page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul id="blog-widget"></ul> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
var blogId = '6a00d83455876069e200d83455876369e2'; | |
$( '#blog-widget' ).ready( function() { | |
$.getJSON( | |
'http://api.typepad.com/blogs/' + blogId + '/post-assets/@published/@recent.js?callback=?', | |
{ 'max-results': 5 }, | |
function( data ) { | |
var ul = $( '#blog-widget' ); | |
for ( var i = 0, len = data.entries.length; i < len; i++ ) { | |
ul.append( '<li><a href="' + data.entries[ i ].permalinkUrl + '">' + data.entries[ i ].title + '</a></li>' ); | |
} | |
} | |
); | |
} ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ben, is there a way to use code similar to this to only pull an image from each of these 5 most recent posts?