Related articles or commonly called as Related Post is one of the features that can be made in Blogspot by putting the script that has been created in such a way to be applied on Blogspot. Related Post is widely used by Bloggers to facilitate the viewer Blogspot in search of articles according to their interest. Jams, the related articles are also required to enhance the SEO Bloggers from Blogspot have been made. With this related article, visitors will more easily find Blogspot articles linked with other articles that have been read before. The making of these related articles also require precision in putting script to related articles to be created. Here is a Tutorial on how to create related post on Blogspot. Some steps will be guided in this Tutorial. Here are the steps how to make related post on Blogspot with ease.
- Formerly login to Blogger.
- After Login, Select Template/Design.
- Select Edit HTML.
- Because this time the Blogger Edit HTML display almost as a Notepad, then directly using the search box with CTRL + F or F3. Then search the code </head>.
- If it is found, Copy and Paste the HTML code below and place the above code </head>.
<script type="text/javascript">
//<![CDATA[
var relatedTitles = new Array();
var relatedTitlesNum = 0;
var relatedUrls = new Array();
function related_results_labels(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
var entry = json.feed.entry[i];
relatedTitles[relatedTitlesNum] = entry.title.$t;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
relatedUrls[relatedTitlesNum] = entry.link[k].href;
relatedTitlesNum++;
break;}}}}
function removeRelatedDuplicates() {
var tmp = new Array(0);
var tmp2 = new Array(0);
for(var i = 0; i < relatedUrls.length; i++) {
if(!contains(tmp, relatedUrls[i])) {
tmp.length += 1;
tmp[tmp.length - 1] = relatedUrls[i];
tmp2.length += 1;
tmp2[tmp2.length - 1] = relatedTitles[i];}}
relatedTitles = tmp2;
relatedUrls = tmp;}
function contains(a, e) {
for(var j = 0; j < a.length; j++) if (a[j]==e) return true;
return false;}
function printRelatedLabels() {
var r = Math.floor((relatedTitles.length - 1) * Math.random());
var i = 0;
document.write('<ul>');
while (i < relatedTitles.length && i < 20) {
document.write('<li><a href="' + relatedUrls[r] + '">' +
relatedTitles[r] + '</a></li>');
if (r < relatedTitles.length - 1) {
r++;
} else {
r = 0;}
i++;}
document.write('</ul>');}
//]]>
</script>
- Next find the HTML code <data:post.body/>, After see you copy and paste the HTML code below. Place it right under the code <data:post.body/>.
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:blog.pageType == "item"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels&max-results=5"' type='text/javascript'/>
</b:if>
</b:loop>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<h4>Related Post</h4>
<script type="text/javascript">
removeRelatedDuplicates();
printRelatedLabels();</script>
</b:if>
- On the last step, save the template and see the result.
- The above code not everything fit. There are a few templates that do not support script Related Post above. If it does not appear, then the templates that you use do not meet the above script.
So the Tutorial Create Related Post at Blogspot by http://hermantos.com. Hopefully what is already in the share in http://hermantos.com beneficial for all who need it. Thank you for visiting the http://hermantos.com.
3 Komentar untuk "How to Make Related Post on Blogspot"
Hey dude, it's doesn't work on my blog. please help me.
Thank you... it's work in my blog. And now, my blog have related post. :)
its work http://panduanmu.blogspot.com/ thanks!