Google's crawler won't understand own maps. How to workaround?

前端 未结 6 1912
我寻月下人不归
我寻月下人不归 2021-02-13 23:18

I found strange words, (have, here, imagery, sorry) that were supposed not to be on my site, being taken as keywords by the crawler from Google

6条回答
  •  故里飘歌
    2021-02-13 23:47

    Unfortunately i saw this a lot too...

    My assumption is that googlebot won't fully evaluate all js code on a page, but will use heuristics as well. Thus getting no imagery (which gets indexed). Based on this assumption I did the following:

    1. Create a div with a "random" ID (for the map) and style="display: none;"

    2. Create a noscript tag with an img tag in it with the SAME "random" ID (i used a static map image as fallback here, which is also good as a no-js fallback)

    3. Create a (custom) javascript function where the unique ID must be passed to initialize your map AND toggle the display style to block on the map-element.

    So far, none of the maps "sorry we have no imagery" gets indexed.

    Hope it helps

提交回复
热议问题