The related post are picked from other articles in the same label or category, for example, The posts in 'How tos' label will show beneath each article under the same label.
Adding related post to your blog(blogspot)
Step 1. Login to your blogger account, goto blogger dashboard and click on template
Step 2. Click on "EDIT HTML"
Step 3. Click anywhere inside the template code box and search for "</head>" without quote
Step 4. Copy and paste the following code just below or above the </head > in your blog template Html code
<!- -Related Posts with thumbnails Scripts and Styles Start- ->
<b:if cond='data:blog.pageType =="item"'>
<style type='text/css'>
#related-posts{float:left;width:auto;}
#related-posts a{border-right:1px dotted #eaeaea;}
#related-posts a:hover{background:#f2f2f2;}
#related-posts h2{margin-top:10px;background:none;font:18px Oswald;padding:3px;color:#999999; text-transform:uppercase;} #related-posts .related_img {margin:5px;border:4px solid #f2f2f2;width: 100 px;height: 100 px;transition:all 300ms ease-in-out;-webkit-transition:all 300ms ease-in-out;-moz-transition:all 300ms ease-in-out;-o-transition:all 300ms ease-in-out;-ms-transition:all 300ms ease-in-out;}
#related-title {color: #222 ;text-align:center;padding: 0 10px;font-size:14 px Oswald; line-height:16px;text-shadow:0 2px 2px #fff;height:28px;width:100px;} #related-posts .related_img:hover{border:4px solid #E8E8E8;opacity:.7;filter:alpha(opacity=70);-moz-opacity:.7;-khtml-opacity:.7}</style>
<script type='text/javascript' src='http://helplogger.googlecode.com/svn/trunk/relatedposts.js' /></b:if><!- -Related Posts with thumbnails Scripts and Styles End- ->
NOTES: You can work on this code by editing it. To display related post in your homepage, remove the code in green
Step 5. Then find the following code (you might find it twice, stop at the second one)
<div class='post-footer'>
Step 6. Now above it,copy and paste the below code:
<!- -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 >
<b:if cond='data:blog.pageType ==
"item"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels_thumbs& max-results=7"' type='text/javascript'/></b:if > </b:loop >
<script type='text/javascript'>
var currentposturl="< data:post.url/>";
var maxresults= 7;
var relatedpoststitle="<b> Related Posts:</b>";
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs(); </script>
</div><div class='clear'/>
</b:if>
<b:if cond='data:blog.url ==
data:blog.homepageUrl'><b:if
cond='data:post.isFirstPost'>
<a href='http://helplogger.blogspot.com'><img
alt='Blogger Tricks' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7aso8rLtWQsA9uBX2pc-UU2HViYKrUp03liw6t-BV3JQBbvJx3wy8OrxJ69UYcKz8LMKbxvGPFOdkN-vZwH4_J5m3Notusc8E-MCQb7eyKY6FgdRcoJ_mVwhvdaL8fXHHeeuAU9Q5wOWT/s1600/best+blogger+tips.png'/></a>
</b:if></b:if><!- -Related Posts with Thumbnails Code End- ->
Step 7. Click on Save template to save.
NOTE: Change the 7 in max-results= 7 to the maximum number of posts you want to display.
0 comments:
Post a Comment