Skip to content

Instantly share code, notes, and snippets.

@btrott
Created April 7, 2010 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btrott/358553 to your computer and use it in GitHub Desktop.
Save btrott/358553 to your computer and use it in GitHub Desktop.
Sample code for embedding TypePad blog posts in a page
<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>
@briannamewborn
Copy link

Ben, is there a way to use code similar to this to only pull an image from each of these 5 most recent posts?

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