Search code examples
web-crawlergoogle-crawlers

Odd scenario / hide names from Google crawlers


My client has a blog and wants to hide all mentioned names from Google's crawlers. For this reason he wrote all personal names l.i.k.e t.h.i.s., seperating each letter with a dot. This approach seems to work, but as I am rebuilding his site right now I am looking for ways that still work, but look less shit and are readable. The dotted pattern is easily replaceable with regEx and I have no problem stripping the dots with PHP, but my question is, what should I replace them to?

  • I thought about tags l<em>.</em>i<em>.</em>k<em>.</em>e s<em>.</em>o, so the dots could be hidden via CSS but wouldn't those tags just be stripped by crawlers, leaving the names loud and clear?
  • What about leaving the dots in the source but stripping them by JS? Would crawlers see the result or the source?
  • Anything else I haven't thought about?

Thanks for hints and ideas!


Solution

  • Anything you write into the page from a JavaScript file that is blocked from crawling with robots.txt won't get indexed by search engines.

    file.html

    <!doctype html>
    <html><head>
    <script src=/write_name.js>
    </head><body>
    Your name is <div id=name1></div>
    </body></html>
    

    write_name.js

    document.addEventListener("DOMContentLoaded",function(){
        document.getElementById('name1').innerText = "John Doe"
    })
    
    

    robots.txt

    User-Agent: *
    Disallow: /write_name.js
    

    See Preventing robots from crawling specific part of a page