Create simple recent post with thumbnail in blogger

Create simple recent post with thumbnail using blogger API & JavaScript
You can make it appear differently, just change this code
var item = '<div class="wrapper" style="width:200px; padding:3px"><img style="width:200px"  src='+ Thumb +' /><p><a href=' + postUrl + '>' + postTitle + '</p></a></div>'; 

<script type="text/javascript">
function mycallback(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
for (var j = 0; j < json.feed.entry[i].link.length; j++) {
if (json.feed.entry[i].link[j].rel == 'alternate') {
var postUrl = json.feed.entry[i].link[j].href;
var ImageSize = 100;
break;}}
var postTitle = json.feed.entry[i].title.$t;
var Thumb = json.feed.entry[i].media$thumbnail.url.replace(/\/s72\-c\//,'/s300/');;

if( typeof Thumb == "undefined" ) {
Thumb = '/Your custom image url';}
var item = '<div class="wrapper" style="width:200px; padding:3px"><img style="width:200px" src='+ Thumb +' /><p><a href=' + postUrl + '>' + postTitle + '</p></a></div>';
document.write(item);
}
}
</script>
<script src="https://smag-soratemplates.blogspot.com/feeds/posts/summary?max-results=5&alt=json-in-script&callback=mycallback"></script>
Create simple recent post with thumbnail in blogger

© 2025 Manajmnt code

Share to :

Related

Comments

Post a Comment

message