How do I tell Googlebot to skip part of the HTML?

There is a lot of information about the opposite situation when people try to use material in HTML, which is visible to Google bots but is not accessible to users. In my case, I need another thing - hide some of the html from google bot. The question is how?

Flash is not the answer,
Would you rather not use fancy ajax stuff (mainly because I need it right now, and not on a finished document),
In addition, robots.txt is not the answer as it works with URLs, not parts of the page. Will some special css / plain javascript work, some special html tag for this?

+6
source share
6 answers

Maybe the server side of the base64 encoding server and subsequent decoding on the client side can work?

the code:

<!-- visible to Google --> <p> Hi, Google Bot! </p> <!-- not visible from here on --> <script type="text/javascript"> document.write ("<?php echo base64_encode('<b>hey there, user</b>'); ?>"); </script> 

What does the bot look like:

 <!-- visible to Google --> <p> Hi, Google Bot! </p> <!-- not visible from here on --> <script type="text/javascript"> document.write (base64_decode("B9A985350099BC8913==")); </script> 
+8
source

Create a Div, Download the Div (ajax) content from the html file located in the directory protected by robots. Example. /index.html

Somewhere in the header. (check out http://api.jquery.com/jQuery.ajax/ )

 $.ajax({ url: '/hiddendirfrombots/test.html', success: function(data) { $('#hiddenfrombots').html(data); } }); 

... somewhere in the body

 <div id="hiddenfrombots"></div> 

create the "hiddenfrombots" directory and put followin in the roots of .htaccess

 User-agent: * Disallow: /hiddenfrombots/ 
+4
source

If you can use PHP, just enter your content, if not Googlebot:

 // if not google if(!strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot")) { echo $div; } 

How could I solve this problem.

+2
source

This should do the trick:

 <!--googleoff: index--> <p>hide me!</p> <!--googleon: index--> 

For more information, check out the link to the Googles page, which describes it in more detail.

Exclude unwanted text from an index

+2
source

just create an image with text that you don’t want to see on Google.

0
source
  • Download content via an Ajax call
  • But create a JS file (for example: noGoogleBot.js) that contains a function that implements the ajax call:

     $.ajax({ url: 'anything.html', success: function(data) { $('#anywhere').html(data); } }); 

Then in the robots.txt file

 User-agent: * Disallow: /noGoogleBot.js 

Thus, all divs that are loaded using the function in noGoogleBot will be blocked. Googlebot (or any other crawler) ignores the contents of noGoogleBot.js.

0
source

Source: https://habr.com/ru/post/905719/


All Articles