Possible Duplicate:
Will JavaScript (document.write) content be indexed by search engines?

I've got a site where people can list machinery for sale. Each item for sale has it's own dynamic page. On each of these pages we allow the person selling the item to have a link back to their own website. Some people only sell a handful of items and some people are selling dozens or hundreds of items. So in some cases we can have a 100 links back to their external site.

Our SEO guy is saying this is bad (i'll open another question on that). So i was wondering if i take the links and spit them out using document.write, will that hide them from google and the other SE's ?

  • 2
    Link in comment above deals with JS issue. But why not just use "nofollow" attribute?
    – GDVS
    Oct 2, 2012 at 17:13
  • @GDav has a point, although that's addressed by the second, separate question. This one, concerned with the JS, still looks like it's up for closing.
    – Su'
    Oct 2, 2012 at 17:50

1 Answer 1


Actually, i think i found the solution to this in another post. http://www.seomofo.com/ethics/using-javascript-to-hide-links.html

Basically, have all your links be plain text with a span tag of a specific class. Then have a javascript function in an external file that converts the span to a link. And in the robots.txt block the bots from indexing the external javascript file.

  • The post you have linked to it's outdated (written in 2010). From my experience, Google can read JavaScript. (this doesn't mean this trick wouldn't work necessarily, but it might not work - or not work in the near future. Google is following some divs with onclick event on one of my sites)
    – milo5b
    Oct 2, 2012 at 18:13
  • I just assumed the above might work since the function converting the span to an <a> tag would be in an external follow that google is being told not to index/crawl. Or would it still read the content of the JS file for purposes of rendering the pages and then just not include the contents in it's index?
    – merk
    Oct 2, 2012 at 21:41
  • I would have said this technique would be more successful than document.write in hiding the links from Google. There is an updated article from March 2011 that also discusses this topic: seomofo.com/advanced/do-not-let-google-crawl-javascript.html
    – MrWhite
    Oct 4, 2012 at 0:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.