Recent Posts Gadget With Avatar, Animated Thumbnails & Labels [Quick Guide]

Recent Posts Gadget For BloggerBlogger Recent Posts Gadget with label support is the backbone behind fancy templates being designed these days. We have covered a detailed full series on how these widgets are coded using Blogger JSON Feeds. Today I will share the most advanced Recent Posts gadget for blogspot blogs unlike shared before. It is not only rich in features but also well optimized, responsive and loads lightening fast. It is a two-in-one gadget that can be used to either display latest posts of your blog or latest posts from a specific label. The logic it uses can also be modified to display Random Posts and Related Posts. All these gadgets will be shared this month inshAllah. These gadgets can be completely customized using CSS and its features can be switched on/off using simple Boolean logic.

If you wish to add animation to this widget please read:

We have covered a comprehensive series on how to use Blogger JSON feed to extract data from your blog feeds and parse the JSON data in JavaScript. If you really wish to code these gadgets yourself, you must read this series where we have covered all A-Z steps of blogger gadget development.

We have already shared an advanced recent posts label widget with featured thumbnails earlier. We will use the same logic to code something more useful and productive. Since most of you requested that the comment and labels links should be clickable. Fortunately all your requests have been fulfilled in this new label gadget.

Today’s recent posts widget has some unique features introduced first time online :

  1. Author AvatarUnique!

  2. Clickable Labels – Unique!

  3. Displays recent posts

  4. Displays recent posts from a specific category/label.

    1. Clickable Comments Count

    2. Custom Date Format – Unique!

    3. Clickable Animated Featured Thumbnails – Unique!

    4. Option to increase or decrease thumbnail ResolutionUnique!

    5. Support for Third-party Images and YouTube thumbnailsUnique!

    6. Title Length is adjustable

    7. Summary Snippet Length is adjustable

    8. Total Posts Count for selected label is displayed at bottom – Unique!

    9. Customizable into different layouts using CSS thanks to different nodal IDs. – Unique!

    Why Use Recent Posts Gadget?

    By using Recent Posts Gadgets you can showcase latest posts from different labels to give extra exposure to your blog posts. It also helps you to increase pageviews and ultimately improve blog revenue. You can display posts from a specific label or you can simply display recent posts that just got published recently on your blog. You can display this gadget either on your homepage or your sidebar.

    Search engine visitors who land on your blog would love to see what are the latest posts published on your blog through this gadget on your sidebar instead of going to the homepage. Thus bringing you more pageviews.

    We have used AJAX to display several recent posts gadgets on homepage of COPmo template.

    Install Recent Posts Gadget By Label on your Blog

    Follow these easy steps to install it on your blogspot blog:

    1. Go To Blogger > Template

    2. Backup your template’

    3. Click “Edit HTML

    4. Search </head> and Paste the following CSS code just above </head>:

      <link href=’//’ rel=’stylesheet’/>
      <link href=’’ rel=’stylesheet’ type=’text/css’/>

      /*——Recent Posts Gadget By——–*/
      .mbtlist list-style-type:none;overflow:hidden; margin: 10px 0px!important; width:300px; padding:0px!important;
      .mbtlist li margin:0px auto 10px auto; clear:both; color:#666; font-family:helvetica; font-size:12px; border-bottom:1px solid #eee; overflow:hidden; position:relative
      .mbtlist li a color:#666; text-decoration:none;
      .mbtlist icolor:#999; padding-right:5px;
      .mbtlist .ilineline-height:2em; margin-top:3px;
      .mbtlist .icontentline-height:1.5em; margin-top:5px;
      .mbtlist div spanmargin:0 5px 0 0; display:inline-block;font-weight: normal;
      .mbtlist .mbttitle font-family:oswald; font-size:13px; color:#666; font-weight:normal; text-decoration:none;
      .mbtlist .mbttitle:hover, .mbtlist .itotal a:hover  color:#333; text-decoration:none;
      .mbtlist .iedit atext-decoration:none; color:#999; cursor:pointer
      .mbtlist .iedit:before, .mbtlist .iauthor:before, .mbtlist .itag:before, .mbtlist .icomments:before, .mbtlist .idate:before, .mbtlist .itotal span:beforefont-family:fontAwesome; position:relative; padding-right:8px; color:#999;
      .mbtlist .iauthorpicwidth: 17px;height: 17px;border-radius: 50%;
      float: none; display: inline-block; margin:0px 0px 0px 0px; padding-right:3px; position:relative; top:3px;
      .mbtlist .itag    color: #fff;position: absolute;left: 7px;top: 8px;display: inline-block;font-size: 11px;width: 130px; height:22px;    overflow: hidden;
      .mbtlist .itag abackground:#000;background:rgba(0,0,0,0.7);text-decoration:none;color:#fff;padding:4px 5px;text-transform:capitalize;line-height: 2em;font-family: arial;
          font-size: 11px;border:1px solid #333;
      .mbtlist .itag a:hoverbackground:#222; color:#eee; text-decoration:none;
      .iFeaturedoverflow:hidden;position:relative;float:left;margin:0 5px 10px 0;padding:0;
      .iFeatured a background: url( 0 0;padding: 7px 7px 8px 7px;display: block;
      .iFeatured imgwidth:135px;height:80px;-moz-transition:all .3s;-webkit-transition:all .3s;transition:all .3s;     border-radius: 2px;
      .iFeatured:hover img opacity:1;   -moz-transform:scale(1.4);-webkit-transform:scale(1.4);transform:scale(1.4)
      .mbtlist .icomments acolor:#0080ff; font-family: arial;font-size:12px;
      .mbtlist .icomments a:hovertext-decoration:underline
      .mbtlist .icomments:before content:’f086′; padding:0px 3px 0px 7px; color:#84DB06;
      .mbtlist .idate:before content:’f073′;padding-right:3px
      .mbtlist .iedit:before content:’f040′;
      .mbtlist .imore font-size:16px; font-weight:bold; text-decoration:none; color:#666;
      .mbtlist .itotal color:#333;  padding:5px 0px;
      .mbtlist .itotal a font-family:oswald, arial; font-size:12px; font-weight:normal; color:#0080ff; text-decoration:none
      .mbtlist .itotal span:before content:’f07c’;
      .mbtlist .itotal span font padding:0px 3px; color:#333; font-family:georgia; font-size:15px; font-weight:bold

      Make these customizations:

      • To change link color edit #0080ff

      • To change comment icon color edit #84DB06

    5. Next Go To Blogger > Layout

    6. Choose HTML/JavaScript Widget

    7. Paste the following code inside it:

    <script type=”text/javascript”>

    //#################### Default Settings
    var ListBlogLink = “”;
    var ListCount = 3;
    var ListLabel = “SEO“;
    var ChrCount = 45;
    var TitleCount = 66;
    var ImageSize = 200;
    var showcomments = “on“;
    var showdate = “off“;
    var showauthor = “on“;
    var showthumbnail = “on“;
    var showlabel = “on“;
    var showcontent = “off“;
    var showTotal = “on“;

    //################ Function Start
    function mbtlist(json)
    document.write(‘<ul class=”mbtlist”>’);
    for (var i = 0; i < ListCount; i++)
    .png]”)/) != null)


    ListImage= “”””;

    //################### Printing List

    document.write( “<li class=’node”+[i]+”” >”);
    if (showthumbnail == ‘on’)
    document.write(“<div class=’iFeatured’><a  href=”
    + ListUrl+
      “><img src=”

    if (showlabel == ‘on’)
    document.write(“<span class=’itag’>”
    +ListTag +

    document.write(“<a class=’mbttitle’ href=”
    + ListUrl+
    + ListTitle+
    “</a><div class=’iline’>”);

    if (showauthor == ‘on’)
    document.write(“<span class=’iauthor’><img class=’iauthorpic’ src=””+AuthorPic+””/>”

    if (showcomments == ‘on’)
    document.write(“<span class=’icomments’>”
    +ListComments +
    “</span> “);

    if (showdate == ‘on’)
    document.write(“<span class=’idate’>”
    + M +
    + D +

    if (showcontent == ‘on’)
    document.write(“<div class=’icontent’>”
    +ListContent +
    “…</div> “);


    if (showTotal == ‘on’)
    document.write(“<div class=’itotal’><span> <a href=””+ListBlogLink+”/search/label/”+ListLabel+””>View all <font>”+TotalPosts+”</font> posts in  →  ” +ListLabel+” </a></span></div>”);


    document.write(“<script src=””+ListBlogLink+”/feeds/posts/default/-/”+ListLabel+”?alt=json-in-script&callback=mbtlist’></”+”script>”);

    You can easily choose to show or hide an option using on/off Boolean values. Simple make these settings:

    • Replace with your Blog URL.

    • Mention number of posts to display in ListCount = 3;

    • Replace SEO inside ListLabel = “SEO”; with your label/category for which you wish to display recent posts. Remember that labels are case sensitive. Therefore type it exactly as it is shown in your browser address bar. If your label is “blogging tips” and if you type it as “Blogging Tips” then it wont work. You must make sure that all letters are written in correct cases. 

    • Edit ChrCount = 45; to choose how many characters you wish to display in post description snippet/summary.

    • Edit TitleCount = 66; to choose post title length.

    • You can control the resolution or aspect ratio of thumbnails by editing ImageSize = 150; where the value 150 means that you want your images to be within 150 x 150 pixels in size. Make sure to keep this value close to the image size to ensure website load time is not effected a lot. Since our thumbnail images have a width of about 135px, therefore I have kept the resolution as 150, slightly higher to display images in slightly good resolution.

    • To show an element simply choose on and to hide it choose off. You apply these switch on/off values to these 7 variables: showcomments, showdate, showauthor, showthumbnail, showlabel, showcontent, showTotal 

    • If you want to show recent posts published on your blog and don’t wish to display posts from a specific label then simply remove /-/”+ListLabel+” from the code above. Switch off showTotal and also replace ListLabel = “SEO”;  with this ListLabel = “”;

       8.    Click Save and you are all done!

    Full Third Party Thumbnail Support

    Our Recent Posts widget has the most robust coding algorithm which makes sure to use any available image from your post whether the image is hosted on your blogger Google album, Picasa or hosted somewhere else. It also has the built-in function to extract thumbnails from your YouTube video iframe. It will automatically display the YouTube thumbnail for a post where you may have embedded a YouTube video.  In case the post contains no image at all, it will display a default image of MBT as shown below:

    The image below shows recent posts for this blog.

    Recent Posts Gadget with Thirdy Party Image Support


    Different Ways to Customize Recent Posts Gadget

    By simply changing on/off values you can change the entire layout of the gadget. Let me show you some examples:

    1 Switching off showcontent and showdate will produce this look:

    Recent Posts Label Widget For Blogger

    2 Switching off showcontent, showlabel and showcomments will produce this look:

    Display Recent Posts by label With Thumbnails in blogger

    3 Switching off showcontent, showthumbnail, showcomments and showlabel will produce this look:

    Simple List of Recent Posts With Avatars

    4 Switching off showthumbnail, showTotal and showlabel will produce this look:

    Recent Posts Gadget With Author Avatars

    5 Switching everything on and increasing the width of the class .mbtlist to 350px, will produce this layout:

    Blogger Recent Posts Gadget With Thumbnails


    6 Each “li” tag has its own class (such as .node0, .node1, .node2, etc.) that you can use to customize the look and appearance of each list. By changing these styles you can display recent posts in several interesting layouts such as:

    Vertical List of Recent Posts With Large Thumbnail at Top:

    Vertical List of Recent Posts Gadget With Animated Thumbnails

    Horizontal List of Recent Posts With Large Side Thumbnail:

    Horizontal List of Recent Posts Widget With Thumbnails

    This is the exact same technique that I used to design COPmo template.

    What is Next?

    Using the same logic as discussed several times in our JSON series and using the code above, we will create a list of random posts, related posts, sliders, carousels and news tickers. Stay tuned for lots of interesting tutorials. Know that we do not aim at only sharing fancy widgets, our true aim is educating our readers with the best knowledge so that each one of you could code his own gadgets and be the next big web developer.

    In our last posts on recent posts widget, we asked how can you modify the code to display posts via a specific label. To which Ehsan Qureshi gave the correct answer and as a result of which I give my token of thanks to him for particpating in the contest and winning a backlink for his blog “Tips Tricks Island“. Do visit his blog and give him your feedback. =)

    Anyone who can suggest how to modify the above script to display random posts on each page load, will win the next PR5 free link. Your widget must fetch random posts from a blog JSON feed and then display that list. User must see different random posts list each time the page is refreshed. Share this post with your friends who are JSON or JavaScript enthusiast. 

    Do share your feedbacks and queries in the comments box below. Let me know if you need any help or assistance. Would love to help! =)

    1 comment:

    1. This is an awesome post. Really very informative and creative contents. This concept is a good way to enhance knowledge. I like it and help me to development very well. Thank you for this brief explanation and very nice information. Well, got good knowledge.
      WordPress development company in Chennai


    Powered by Blogger.