Showing posts with label Thumbnails. Show all posts
Showing posts with label Thumbnails. Show all posts

Display Post Summaries and Automatic Thumbnails



With only a few small changes to our Blogger template, we can display post summaries and thumbnails using this easy to manage hack.

How to add Blogger post summaries and thumbnails in three simple steps


Here's my step-by-step guide to the easiest solution for post summaries and thumbnails with Blogger:

Step 1 - Back up your template!


It is important to back up your Blogger template before making any edits. This ensures we can easily restore the working template if anything goes wrong.

You'll be prompted to save an XML file to your computer hard drive - this XML file includes all of the HTML and widget templates required to display your current Blogger design. Be sure to save this in an easy to remember location and make a note of the file name in case you later need to restore your working template.

Step 2 - Add the code to display summaries and thumbnails on non-item pages


The next stage is to add the Blogger code which will display a summary and thumbnail of our posts. Go to Design>Edit HTML and check the Expand widget templates box and search for the following line of code:

<data:post.body />

Replace this line with the following code:

      <b:if cond='data:blog.pageType != "item"'>
          <b:if cond='data:post.snippet'>
          <b:if cond='data:post.thumbnailUrl'>
              <div class='Image thumb'>
                <img expr:src='data:post.thumbnailUrl'/>
              </div>
          </b:if>
            <data:post.snippet/>
    <b:if cond='data:post.jumpLink != data:post.hasJumpLink'>
      <div class='jump-link'>
        <a expr:href='data:post.url + "#more"' expr:title='data:post.title'><data:post.jumpText/></a>
      </div>
    </b:if>
          <b:else/>
            <data:post.body/>
          </b:if>
      <b:else/>
      <data:post.body/>
      </b:if>


Preview the change to your template and you'll see that your posts will appear in a format similar to this:



As seen in the screenshot above, the thumbnail appears above the summary. We can align the thumbnail more cohesively to the left or right of the summary by adding CSS to our template.

At this stage, you can choose to save the edit to your template or add the CSS and preview the final effect before committing the changes to your site.

Step 3 - Add CSS to align the thumbnail image


While still on the Design>Edit HTML section of your dashboard, search for the following line:

</b:skin>

Immediately before this line, paste the following CSS statement:

.thumb img {
  float: left;
  margin: 0 10px 10px 0;
}

This will align the thumbnail to the left of the post summary, and allow some distance between the thumbnail and text like this:


If you would prefer to align your thumbnail image to the right, paste the following code instead:

.thumb img {
  float: right;
  margin: 0 0 10px 10px;
}

Preview your template to see how this makes your posts appear on the home page. When you're happy with the layout, save your template and enjoy your automated thumbnails!

How this customization displays summaries and thumbnails


While simple to add to our Blogger template in order for the function to work, there is a lot of complex conditional code in use to ensure the summaries display as they should.

First, the code checks if the page being viewed is an item page or not. If the page is not an item page, the summary/thumbnail code will come into effect.

The second check discovers if a post snippet is available (i.e: if the post contains some text). If there is a snippet, the code checks if a thumbnail is available and displays the thumbnail if there is, followed by the snippet. Where no thumbnail is available (when the post does not contain an image), only the snippet is displayed.

If there is no snippet available for a particular post, the complete body of text is displayed normally. This ensures that posts with no content or which feature only an image are displayed normally; no thumbnail is displayed, and any images are displayed at full size.

Finally, the code checks if the post contains the <!-- more --> tag. If it does not contain this tag, a "Read more" link will be displayed beneath the snippet, ensuring visitors can easily click through to read the post page. Where a jump-link is present, this is displayed as normal after the snippet.

Related Posts Widget with Thumbnails for Blogger



To increase the look of the page / user can use a link related posts with thumbnail and linking with other similar posts. Users will be tempted to go for the related posts when they are presented attractively with thumbnails. This one also uses the media thumbnails generated by blogger for each post. For displaying the thumbnails,this widget will use the images uploaded for the post using the blogger image uploader (from the post editor) and supports external images also.

Here are the detailed steps to install the related posts widget for blogger with thumbnail.
  1. First of all Login to your blogger dashboard and navigate to Layout > Edit HTML and check the "Expand Widget Templates" check box.
  2. Look for
  3. </head> and paste the copied following Code just above the line
    
    <!--Related Posts with thumbnails Scripts and Styles Start-->
    <!--remove--><b:if cond='data:blog.pageType == &quot;item&quot;'>
    <style type="text/css">
    #related-posts {
    float:center;
    text-transform:none;
    height:100%;
    min-height:100%;
    padding-top:5px;
    padding-left:5px;
    }
    #related-posts h2{
    font-size: 1.6em;
    font-weight: bold;
    color: black;
    font-family: Georgia, &#8220;Times New Roman&#8221;, Times, serif;
    margin-bottom: 0.75em;
    margin-top: 0em;
    padding-top: 0em;
    }
    #related-posts a{
    color:black;
    }
    #related-posts a:hover{
    color:black;
    }
    #related-posts  a:hover {
    background-color:#d4eaf2;
    }
    </style>
    <script type='text/javascript'>
    var defaultnoimage="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy_tHFhQRl_mHel1qvgyTiE20QpFi0hqB5uWJsWAT01tQ-sqhDtOkUFne_65h-SIvI0-M_KF4YNLV30DBquOWxd3oW_F9nb9Ds7_B88RiYAfG-UWG7IXj80nOwdiF-9CHxMO7bfddMQ1M/s400/noimage.png";
    var maxresults=5;
    var splittercolor="#d4eaf2";
    var relatedpoststitle="Related Posts";
    </script>
    <script src='http://blogergadgets.googlecode.com/files/related-posts-with-thumbnails-for-blogger-pro.js' type='text/javascript'/>
    <!-- remove --></b:if>
    <!--Related Posts with thumbnails Scripts and Styles End-->
    </head>
    
  4. You can adjust the maximum number of related posts being displayed by editing line 33 in the code.
  5. var maxresults=5
  6. To edit the title of the widget you can change line 35 of code
  7. var relatedpoststitle="Related Posts";
  8. To change the default thumbnail, you can edit line 32 of code>/li>

    
    var defaultnoimage="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy_tHFhQRl_mHel1qvgyTiE20QpFi0hqB5uWJsWAT01tQ-sqhDtOkUFne_65h-SIvI0-M_KF4YNLV30DBquOWxd3oW_F9nb9Ds7_B88RiYAfG-UWG7IXj80nOwdiF-9CHxMO7bfddMQ1M/s400/noimage.png";
    

  9. To Change the Colour of the Splitter Line , edit line 34 of code

  10. var splittercolor="#d4eaf2";
    To change the other colours and all you will have to modify the CSS

  11. Now Find

  12. <div class='post-footer-line post-footer-line-1'>
    If you cant find it then try finding this one
    <p class='post-footer-line post-footer-line-1>
    Now immediately after any of these lines(whichever you could find) place this code snippet.

<!-- Related Posts with Thumbnails Code Start-->
<!-- remove --><b:if cond='data:blog.pageType == &quot;item&quot;'>
<div id='related-posts'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast != &quot;true&quot;'>
</b:if>
<script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=related_results_labels_thumbs&amp;max-results=6&quot;' type='text/javascript'/></b:loop>
<script type='text/javascript'>
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs(&quot;<data:post.url/>&quot;);
</script>
</div><div style='clear:both'/>
<!-- remove --></b:if> 
<b:if cond='data:blog.url == data:blog.homepageUrl'><b:if cond='data:post.isFirstPost'>
<a href='http://www.bloggerplugins.org/2009/08/related-posts-thumbnails-blogger-widget.html'><img style="border: 0" alt="Related Posts Widget For Blogger with Thumbnails" src="http://image.bloggerplugins.org/blogger-widgets.png" /></a><a href='http://bloggertemplates.bloggerplugins.org/' ><img style="border: 0" alt="Blogger Templates" src="http://image.bloggerplugins.org/blogger-templates.png" /></a>
</b:if></b:if>
<!-- Related Posts with Thumbnails Code End-->

To display the related posts on every page and not only on the post pages

Just remove the two lines starting with <!-- remove --> from both step 2 and step 7. That is lines <!-- remove --><b:if cond='data:blog.pageType == &quot;item&quot;'> and <!-- remove --></b:if> Done !! [Update : Increase traffic to your best posts by adding related links with Outbrain's Thumbnail Widget. The widget is free, simple to install and will automatically inherit the look and feel of your site. Set your preferences and in less than 60 seconds, your readers will begin seeing thumbnail images linking to great content.]

Random Posts Widget with Thumbnails for Blogger



The Random Posts Gadget will  display a list of Random Posts(from your blog) on your Blog’s Sidebar. The Gadget has an options panel and can be configured to meet your needs. The Gadget inherits styles from your Blog. But you can override the colors if you want(this was done to support third party templates which doesn’t have the skin variables properly designed).

Photobucket

About the Various Options


Maximum Length of Post Title – Your post titles can be too long. In that case you can limit the title to x number of characters using this parameter.
Snippet Style – You can display the snippet with Post Summary, Post Thumbnail, or both or none.
Feed – The default Option “Summary Feed” will scan your post summary feed. This is the faster and efficient option and i would advise you to opt this one. If you choose  “Full Feed” , the gadget will be slower but you will get YouTube Thumbnails also.

Note:- If you want to grab the images or YouTube thumbnails, then you should have “Site Feeds” set to Full. If you opt for the Media Thumbnail only, then the short feed will be used by default.

Thumbnail Dimensions – Size of the Thumbnail in pixels. The gadget doesn’t generate any Thumbnail. It just uses the media thumbnail,YouTube thumbnail , or any image in the post and scales it to the specified dimensions.
Summary Length  -  If you have opted to display the post Summary, then you can control the length of the summary(in characters).
Post Meta Style – You can display the Post Date, Comment Count and a Read More Link. You can choose any combination of these three.
Font and Font Size– By Default, the container’s font and Font Size is inherited into the Gadget. But if you are using a 3rd party template, then these might not be properly inherited. In that case you can use this Option to over ride these parameters.
Extra Styling – Allows you to specify the position of the Thumbnail, and whether to underline the links or not.
Border Color – You can either opt for No Border, or select one of the 140 available colors. If you are not sure about how these colors look like, then take a look at this color chart at W3Schools - http://www.w3schools.com/html/html_colornames.asp
Link Color and Text Color – By default , the colors will be inherited from your Blog. If you want to override this, you can choose one out of the 140 different colors. (The colors were provided in the Dropdown(and not as text fields) to tackle a problem with the API)
Read More Text – This field was intentionally added to help blogs which are not written in English. Initially i used “More »” as the Read more text without taking any user Input. Seeing this on a non-English Blog is a little awkward. So i added this new field.

Add The Gadget to your Blog


Check out the Demo and Sample Configurations to see what the Gadget can do.

Demos
© 2011 Template For Blog. WP Themes by Skatter Tech. Bloggerized by Bambang Wicaksono.
Scroll down for Next Widget
 
BLOG MENU
Go
to
Top