I want to prevent that Google indexes the contents of one
I asked on Google forums and the answer is: It doesn't
Updating this thread. While google will still crawl and index, you can prevent it from showing up in search results with data-nosnippet attribute in the HTML. Can be used in <div>
, <span>
, and <section>
elements.
Example: <p><span data-nosnippet>Harry Houdini</span> is undoubtedly the most famous magician ever to live.</p>
See here
Your question is a bit unclear. You should clarify if you are concerned about negatively or positively affecting your rank.
I don't think one can fully know if using your method will affect your SEO rank either negatively or positively. Will your rank be penalized for using reversed text? Maybe if you are stuffing keywords or other spammy type content in the div. It is quite possible that Google's crawler can interpret your CSS and read the text anyway, as it was meant to be read.
Another option that might work to prevent Google from crawling a specific element is to use javascript. For example, place the javascript below in an external JS file and link to it in the head or bottom of your web page.
<script>
function jsText() {
document.getElementById("noindex").innerHTML="The quick brown fox jumps over the lazy dog.";
}
</script>
Then use the following for the div where you want the hidden text to be displayed.
<div id="noindex">
<script>
jsText();
</script>
</div>
This should write the text in the div via javascript. Google can also crawl javascript so it might still find the text and index it. To further reduce the potential that Google will crawl the javascript you could exclude the javascript file in robots.txt as well.
Wouldn't it be possible for you to create a new html file where you put the text and the metatag
<meta name=”robots” content=”noindex”/>
Then you can just include the html with iframe or something similar on your main page.
I want to prevent that Google indexes the contents of one on my page
Then I think you shouldn't put that content on the page, period.
You could try using the googleon/googleoff tags, per this article:
Tell Google to Not Index Certain Parts of Your Page
<!--googleoff: index-->
don't index this content
<!--googleon: index-->
Then again, I find this article which states that it isn't possible:
http://productforums.google.com/forum/#!topic/webmasters/qrBI_v-N4N0
How to tell Google not to? =============
You don't!
If it is content, If it is part of that page, then it Will be Crawled, and may be Indexed and Ranked
You cannot use a Meta-Tag, or a HTML tag to tell Google to ignore, discount, not use, refer or touch part of your content.
I used server side codes to hide div from googlebot
<?php if(self::isNotGoogleBot()):?>
<div id="noindex"></div>
<?php endif?>
public static function isNotGoogleBot()
{
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
if(strpos($ua,'googlebot') === false && strpos($ua,'mediapartners-google') === false)return true;
return false;
}