I would like to make Google ignore a div containing functional buttons and action titles, which I've seem come up in search engine results.

Now I know about <!-- googleoff: index --> tags, however, I can't use them because all pages are compressed (comments, whitespaces removed) before they're output.

Is there any alternative? Perhaps there is a Microdata solution to show that the div does not contain information about an entity (product in this case, button are "Add to Cart", etc.).

  • You can see here http://stackoverflow.com/questions/8821256/how-to-tell-google-bot-to-skip-part-of-html You could find a solution ;) Oct 19 '15 at 12:00
  • 2
    Google will show the text snippet it believes is most relevant to the user's search query. You'd be better off trying to figure out why it believes your add to cart buttons are more relevant than the other content on the page, and trying to improve that content appropriately. Oct 19 '15 at 12:22
  • @TimFountain It's probably the layout, the functional buttons are in between product data. Can't really change it too much at this moment.
    – gskema
    Oct 19 '15 at 12:24
  • @GillesBodart I see the idea of the solution, but it's really messy :( Google can also follow small snippets of JS code now.
    – gskema
    Oct 19 '15 at 12:26
  • 1
    FWIW googleoff applies to Google Search Appliance, not general Google search results. Reference: stackoverflow.com/questions/14314111/…
    – MrWhite
    Oct 19 '15 at 14:08

First on: googleoff works only in google custom search appliance.

for your goal there are only pretty limited possibilities:

  • instead of div you can put your content from the div into an image (button as an imagemap link)
  • another way is to encode the content with base64 and to hide then the decoding javascript from Google
  • you can load the div content from an external file with an iframe. The external file should be noindex-ed.

Or another way is to create a empty div tag and populate the content of the div via javascript/jquery.

document.getElementbyid('divid').innerhtml.value = "bla bla bla"

The code's syntax may not be correct but the idea will work. Bots dont pick JavaScript dynamic values. You can call a function on page load and use the above code to populate your

Bascially, such a will be empty when you 'view source' the page.

  • Google parses JavaScript so this content will be very visible to them.
    – John Conde
    Oct 20 '15 at 21:55

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