Sunday, February 5, 2012

Recent Posts Widget with Thumbnails





At least some of you would be familiar with My "Recent Posts with Thumbnails" Gadget for Blogger. I had got so many complaints that the Gadget fails to load or has some issues. So I decided to make a Widget version of the same.

Why the other Gadget fails at times?

The other gadget is made using the Gadget API. The API renders the gadget as an iFrame with all the parameters appended to the iFrame URL. When the iFrame url becomes too big, browsers have issues rendering the gadget. This primary reason behind this is that the API appends so many style parameters to the iFrame URL thereby making it pretty lengthy.The current page url is also a parameter.That is why some people complain that it is working on the home page, whereas it doesn't work on some of the post pages. The reason is that your home page url is shorter in length than your post page url. So it is almost impossible to make the gadget error free.

So What now?

This new Widget doesn’t rely on the Gadget API, and is not loaded as an iFrame. This is a plain JavaScript widget, and will work across all browsers.

What’s special about this new Widget?

If you are good at CSS, you can make the widget exactly as you want. There is no limit in customizing this Widget. This doesn’t mean that it is useful only to those who are familiar with CSS. The Widget by default will inherit your Blog’s Styling. So it should look pretty neat with the default Styling

Options in the Widget Installer

  1. Blog URL: This should be the URL of a blogger Blog. If you are installing the Widget on the same blog then you can leave this field blank . This field is useful for those who have multiple blogs..
  2. Number of Posts – The number of posts displayed in the Widget
  3. Maximum title Length – This option can be used to chop off really long Post Titles. If a post title is longer than this length, the widget will chop off the rest of the title
  4. Show Thumbnail – It’s pretty much obvious from the name
  5. Show Default Thumbnail – If this option is selected, and your post doesn’t have an image, then a default image will be displayed.
  6. Thumbnail Dimension – The gadget can generate square thumbnails of any size. Use this option to set the dimension of the thumbnail.
  7. Float Thumbnail to – This option can be used to align the image thumbnail to the left or to the right
  8. Thumbnail Margin – You can set a 5px margin to the image, so that the thumbnail stays apart from the post summary. You can override the margin by selecting No.(You can then manually style it using CSS)
  9. Show summary
  10. Summary size – If summary is more than this length, then the widget will chop off the rest
  11. Show post date
  12. Show Comment Number
  13. Show Read more Link
  14. Read More Text – This is the Text Shown on the Read More Link
  15. Use Full Feed – By default the Widget will use the Blogger Summary feed which is smaller in size. If you select the Full Feed option, it will use the Full Feed which is bigger in size, and hence the Widget would get slower. The advantage is that, you would get thumbnails of YouTube videos that you have posted.
  16. Sorting – Helps you in displaying the recently published posts or recently updated posts.
Now that you are clear with the options, use the below button to add the Widget to your Blog.
Add Recent Posts Widget

Advanced Options:

1. Default Thumbnail
If the Widget is unable to find an image in the Post and if Options 4 and 5 are checked, then the Gadget will use the following image by default
If you want to change this default thumbnail, then you will have to first upload the Thumbnail somewhere. The best place to upload is blogger. So create a new post(or edit an existing one) and add the image to the post. Now Switch to the Edit HTML view of the Post Editor. There you will find a URL which contains “/s1600/” in it. Copy that URL. Change /s1600/ to /s72-c/. So finally you will get some URL like
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9129hqnQm56vQvOHjZLjyPoAgziNYMqFC2JzGoKD0_UnyVrOaF2tOQh3HkdLOq2nx5WwLiluMaE4Q8ShvEkkBte_ICFMw2uLJ7KeLD5bdaat0FGu_nlNvEboLrkIS7MzdvgzWu6yKLcw/s72-c/default.png
This is your default Thumbnail's URL. Now it’s time to tell the script to make use of this Image. For that Edit the HTML/JavaScript Widget(Recent Posts) and add the following variable:
var defaultImage=”THUMBNAIL_URL_WHICH_HAS_/s72-c/_IN_IT”;
(Off course you will have to edit the above line)
If you are not sure where to add the variable, then add it just before
var numberOfPosts
Save the Gadget and you are done.
2. CSS Styling:
If you are using CSS Styling, make sure that the Thumbnail Margin is set to None. You can also set the Thumbnail Float to None. This will prevent the Widget JavaScript from adding any Styles to the Post List.
You can add your CSS at Template Designer > Advanced > Add CSS
Some Sample CSS snippets are there in the comments.
3. Tracking the Widget Usage
I have appended a utm_src parameter to the recent post URLs.This will help you in tracking the widget usage from your Google Analytics account(Traffic Sources > Campaigns).
4. Remove the Powered By Link
If you can’t stand the powered by Link at the bottom of the widget, then you can hide it. To do that Add this CSS snippet :( :(
.bp_footer{display:none;}
If you don’t know how to add CSS read the CSS Styling (2) part in these Advanced Options.
Hmmm at the moment, I’m a little lazy to create a Demo Blog. You can expect that sometime soon.
If you have any doubts or questions or suggestions, feel free to comment here and I will try my best to reply to each of your comments.
I know that many bloggers are having issues in using the old Gadget. So kindly help others by sharing this new post :)

0 التعليقات:

Post a Comment