Contextual Related Posts in Blogger Blogs - Internal Testing

Today while looking at Google Webmaster Tools, I came across some 404 pages on Tweak And Trick. Being curious, I proceeded to see which pages does Google report as "Not Found" and I came across a strange URL, one which I have never seen associated with a Blogger blog. The URL which Google reported as not being found was as follows:-

related posts
  • http://www.tweakandtrick.com/ related-content.g?q=

Update: Blogger has disallowed the related-content.g?q= page through robots.txt. It will no longer be anything worth worrying about.

Update: This was not what I had expected. This was for a related content search engine.

When I checked on to see which pages linked to this page, I was surprised to see that almost all of the pages on this blog had links pointing to this page. As I did not remember placing such a link, I checked the source code of my blog. Strangely, I discovered a new bit of JavaScript added to it. The script which was added is as follows:-


<script type="text/javascript">
    
    function setAttributeOnload(object, attribute, val) {
      if(window.addEventListener) {
        window.addEventListener("load",
          function(){ object[attribute] = val; }, false);
      } else {
     window.attachEvent('onload', function(){ object[attribute] = val; });
      }
    }
    function showRelatedContent() {
      var el = document.getElementById('related-frame');
      if (el.style.visibility = 'visible') {
        return;
      }

      el.style.visibility = 'visible';
      el.src = 'related-content.g?q=' /* insert URL here */;
      showRelatedContent.prevOnClick = document.onclick;

      // Hide related-content dropdown when clicking anywhere but on it.
      document.onclick = function() {
        var el = document.getElementById('related-frame');
        if (el.style.visbility != 'hidden') {
          el.style.visibility = 'hidden';
        }
        document.onclick = showRelatedContent.prevOnClick;
      };
    }
    
  </script>
     
Anyone having basic knowledge of Java would understand that this code is for generating contextually related posts for blogger. So, this indicates that after launching the mobile supported themes, the Blogger development team is finally off to add another new and often demanded feature in Blogger, and gladly it is one that will help bloggers to reduce bounce rate and display more appropriate related posts.

Investigating further, I have come to know that each blog hosted on Blogger has received this new bit of code implying that this feature would be made public any time soon.

Meanwhile, you can use the related posts widget I have employed here.

Steps:-
1. Just, copy and paste this CSS in your design before </head>.


<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 .widget{padding-left:6px;margin-bottom:10px}
#related-posts ul{list-style-type:none;margin:0 0 0px 0;padding:0px;text-decoration:bold;font-size:12px;text-color:#000}
#related-posts ul li{background:transparent url(http://2.bp.blogspot.com/_u4gySN2ZgqE/SnZhv_C6bTI/AAAAAAAAAl4/Rozt7UhvgOo/s200/greentickbullet.png)
 no-repeat;display:block;list-style-type:none;margin-bottom:13px;padding-left:30px;padding-top:0px}
#related-posts .widget h2, #related-posts h2{font-size: 12px;font-weight: bold;margin-bottom:0.75em;margin-top: 0em;padding-top: 0em;}
</style>
<script type="text/javascript">
var relatedpoststitle=&quot;You might also like:&quot;;
</script>
<script src="http://blogergadgets.googlecode.com/files/related-posts-for-blogger.js" type="text/javascript">
</b:if>
 2. Copy and paste the code below under <data:post.body/>.

<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>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=related_results_labels&amp;max-results=6&quot;' type='text/javascript'/></b:if></b:loop>
<script type='text/javascript'>
var maxresults=5;
removeRelatedDuplicates(); printRelatedLabels(&quot;<data:post.url/>&quot;);
</script>
</div>
 </b:if>

 3. Save the template and apply the changes.



Reader Comments

teecup said...

I've been using the "Link Within" widget and have not detected any error... until this morning.

My latest run with Web Analytics now shows the "related-content.g?q=" error, in addition to a recently discovered "rpc_relay.html" error.

Is this something we can leave untouched until Google releases a similar widget like "Link Within"? :)

Akhilesh said...

Hi teecup,

"rpc_relay.html" is not a new error. It is something I am quite familiar with and know that it is not much of an issue as it is nothing but an empty page. However, "related-content.g?q=" is quite a problem as it means that each page on our blogs links to non-existent 404 pages.

This is something we have to leave untouched as there is no way for blogs hosted on blogger to remove the scripts which Google inserts on its own. Lets just wait for an official confirmation and hope this error does not affect our rankings much.

teecup said...

Great! Thanks for the update. I appreciate it.

May I ask... How do I resolve an rpc_relay.html error? I'm not using Blogger's in-house related content feature but Linkwithin's.

Akhilesh Sharma said...

Just like other problems on blogger, there is no way in which we can resolve this error. This is something that must be resolved by the Blogger Development Team. As a Blogger user, all you can do is simply ignore it. :)

ifootballvideo said...

I notice that problem also on mywebmaster account .

First i notice restricted by robot.txt (27) which are all my labels and ifootballvideo.blogspot.com/related-content.g?q= ( Detail (404) not found)under that are all my posts.It seems that everything on my blog is having problem and i also get lots of strange traffic from Mountain View.

Does anyone find some idea for resolving this,or whats going on ?

Cheers

Akhilesh said...

The strange traffic you get is a common form of LOG spam which most bloggers, including me, face. I would advise you to use Google Analytics as it is less prune to this form of spamming.

The labels error you get is also normal and occurs only because Blogspot has blocked all its labels through robots.txt using:-

User-agent: *
Disallow: /search

This is also one of those unresolvable issues I hope Blogger did not have.

Regards

medical health safety said...

I have this kind of problem recently and it gets my nerve out of it considering that it affects my Analytic graph, that I am not receiving any visits at all. It also affects my Alexa ranking.

Thanks for the tutorial, despite being not a techy person I was able to manage it and I am crossing my fingers that it will have an effect.

BTW, how long would it take for the change to take effect? That I will be able to see some activity in my Analytics.

Akhilesh said...

Hi there, I am afraid you are misunderstanding. The related posts widget I have given is just an option to show related posts until Blogger releases the official Related Posts and Media Search.

Also, the "related-content.g?q=" error has nothing to do with showing related posts in your blog using LinkWithin or any other provider (which many webmasters at Blogger Help Group misunderstood it to be).

Moreover, as you can see in the link I provided in the Update, it is official that Related Posts and Media Search is going to be released soon implying that the error is only temporary and will be resolved.

Nicole said...

There is a blogger help forum thread starting about this here: http://www.google.com/support/forum/p/blogger/thread?tid=50d362505d17a88d&hl=en

I'm having the same problem. I think it's in the blogger template code.

Akhilesh said...

Hi Nicole, your thread is not the only one out there. I have seen hundreds of similar threads on Blogger Help forums all begging for a reply to this 404 not found error.

You are not the only one having this problem, every blog that is hosted on the Blogger platform is experiencing the related-content.g?q= error. It is not in the template code. It is a server side script which gets inserted on its own when blog is loaded. Moreover, as far as I can tell, only Googlebot has been able to process this JavaScript as no other search engine displays this error for me.

Tess said...

Hi, Based on your update. Should we do anything about these crawl errors? Should we sit tight and let Google fix this?

Does your update mean that these errors do no have anything to do with a new "show related post" widget?

Thanks for your kind help!!

Akhilesh said...

Hi Tess,

This problem has a solution. I have written about it here :-

http://tweakandtrick.blogspot.com/2011/04/related-posts-media-search-related.html

Regards

Newbie blogger said...

So, does that mean everything is going to be OK now that my robots.txt is:-

User-agent: *
Disallow: /search
Disallow: /related-content.g
Disallow: /related_content_helper.html

Akhilesh said...

Apparently, it does.

Author About
Akhilesh Sharma maintains and writes Tweak And Trick. He is a technology enthusiast and a science student.
You can contact him at tweakandtrick@gmail.com.

read more >>

Get updates by email

Featured Posts