This is Part 2 of our comprehensive tutorial series on Blogger development and template layout customization. Earlier versions of our website were built upon Google’s Blogger platform. While Blogger offers unbeatable hosting reliability and security, template constraints can feel restrictive. Thankfully, Google provides deep access to underlying layout code, allowing developers to craft uniquely branded blogs.
Below, I have organized, tested, and classified scattered tips and techniques for Blogger template design and widget enhancement across the web. I hope this helps you build a better blog! :)
Before editing, please note: once you modify template HTML directly, editing blog post widgets via the graphical “Layout” panel may stop working. If you need specific built-in configurations (such as post location tags), configure them beforehand. Always back up your template before making any edits, or experiment on a dedicated test blog first.
Adding Related Posts with Thumbnails to Post Pages
When browsing our blog, you may notice several “Related Posts” listed at the end of each article. This functionality is powered by custom scripts.
Blogger does not include a native related posts widget out of the box. While you could simulate reader engagement using a “Recent Posts” gadget to keep visitors browsing, recent posts do not necessarily share topical relevance with the article currently being read.
If an automated script can scan the current article’s tags (labels) and pull past articles sharing those same tags, visitors are far more likely to discover genuinely relevant content.
While many commercial third-party widgets exist online, many inject intrusive advertisements into the recommendation area, degrading your site layout.
Below is the clean, thumbnail-supported script implementation I chose after testing various community solutions (Source: Related Posts Widget for Blogger with Thumbnails).
First, log into the Blogger dashboard, navigate to Template > Edit HTML, and check Expand Widget Templates.
Use search (Ctrl + F) to find the closing </head> tag.
Directly before </head>, copy and paste the following style and script block:
<!--Related Posts with thumbnails Scripts and Styles Start-->
<b:if cond='data:blog.pageType == "item"'>
<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, "Times New Roman", Times, serif;
margin-bottom: 0.75em;
margin-top: 0em;
padding-top: 0em;
}
#related-posts a {
color: black;
}
#related-posts a:hover {
color: black;
background-color: #d4eaf2;
}
</style>
<script type='text/javascript'>
var defaultnoimage = "http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.jpg";
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'/>
</b:if>
<!--Vedfolnir Studio, www.Vedfolnir.com-->
<!--Related Posts with thumbnails Scripts and Styles End-->
Next, in the same template editor, search for this anchor line:
<div class='post-footer-line post-footer-line-1'>
Directly below that line, paste the presentation markup below (you can adjust its exact placement according to your layout preferences):
<!-- Related Posts with Thumbnails Code Start-->
<b:if cond='data:blog.pageType == "item"'>
<div id='related-posts'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast != "true"'></b:if>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels_thumbs&max-results=6"' type='text/javascript'/>
</b:loop>
<script type='text/javascript'>
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs("<data:post.url/>");
</script>
</div>
<div style='clear:both'/>
</b:if>
<!--Vedfolnir Studio, www.Vedfolnir.com-->
<!--Related Posts with Thumbnails Code End-->
That completes the setup! Once you visit an article page, you will see dynamically generated related posts displaying relevant thumbnails based on matching tags.
Integrating Facebook Comments into Blogger
While Blogger provides an internal commenting system, embedding Facebook’s social comment module allows discussions to spread across social feeds, bringing valuable exposure to your articles.
First, navigate to the Facebook Developers portal: Facebook Comments Plugin.
Configure the settings to your liking and click “Get Code” to copy the snippet.
In Blogger’s HTML template editor, paste the generated code into the desired comment area within your post container.
Crucial Step: By default, Facebook’s code targets a static URL (href='Your Domain Link'). If left unmodified, every single post on your blog will display the exact same comment thread!
To ensure each post displays its own unique discussion, replace the static href attribute with Blogger’s dynamic post URL data tag:
expr:href='data:post.url'
Adding a Floating “Back to Top” Button
Floating elements remain pinned to a specific screen coordinate as visitors scroll through lengthy content, providing convenient navigation.
To create a floating Back to Top button, copy the CSS snippet below and paste it into the Add CSS section of the Blogger Template Designer:
/* Fixed Bar */
.menu_by_dnowba {
position: fixed;
bottom: 0px; /* Vertical position: replace with top, middle, etc. */
right: 0px; /* Horizontal position: replace with right or left */
width: auto;
margin: 0;
opacity: .90;
filter: alpha(opacity=90);
padding: 0;
-moz-border-radius-topright: 10px;
-moz-border-radius-topleft: 0px;
-moz-border-radius-bottomright: 0px;
-moz-border-radius-bottomleft: 0px;
}
.fixed_menu a:hover img {
position: relative;
top: 2px;
left: 2px;
border-top: 0px solid #b3b3b3;
border-left: 0px solid #b3b3b3;
border-bottom: 0px solid #999999;
border-right: 0px solid #999999;
}
.fixed_menu a { display: block; }
* html .fixed_menu { position: absolute; } /* IE6 fallback */
Next, add an HTML/JavaScript Gadget under Layout, or paste the following HTML snippet into your template:
<div class='menu_by_dnowba'>
<a href='javascript:scroll(0,0)' title='Back to Top'>
<img src='https://www.Vedfolnir.com/your-image.png' alt='Back to Top' />
</a>
</div>
Note: Replace https://www.Vedfolnir.com/your-image.png with the actual URL of your custom arrow or graphic.
Conditionally Showing or Hiding Widgets on Specific Pages
Every gadget or component in Blogger is wrapped inside a <b:widget> element. By wrapping widget contents in <b:if> conditional tags, you can selectively render or suppress gadgets based on page types.
Inside the template HTML editor, locate the target widget block structured like this:
<b:widget id='***' locked='false' title='***' type='***'>
<b:includable id='main'>
<b:if cond='data:blog.pageType != "item"'>
<!-- Widget content rendered here -->
</b:if>
</b:includable>
</b:widget>
You can customize the conditional expression using any of Blogger’s built-in page indicators (substituting == with != to invert the condition):
- Article / Post Pages:
<b:if cond='data:blog.pageType == "item"'> - Archive Pages:
<b:if cond='data:blog.pageType == "archive"'> - Index / Label Pages:
<b:if cond='data:blog.pageType == "index"'> - Homepage:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
Further Reading
- Blogger / Blogspot Layout Design Tutorial and Web Development Notes (Part 1)
- Blogger / Blogspot Layout Design Tutorial and Web Development Notes (Part 3)
- Blogger / Blogspot Layout Design Tutorial and Web Development Notes (Part 4)
Support Independent Perspectives & In-Depth Insights
Every thoughtful analysis and candid critique comes from our dedication to truth and quality. We choose not to follow sensational algorithms or clickbait headlines.
Sustaining independent research requires reader support. Make a one-time or monthly contribution, securely processed by Google.
Payments secured by Google · Manage or cancel anytime in your Google Account


Comments