Reputation: 11
We've got a big problem with all the pages (about 40) on our site that use Google Maps.
Google search robots are indexing "Sorry we have no imagery available", for our pages ie it actually believes that is our content (In Webmaster Tools one of our top content keywords is "Sorry"
We have done lots of tests and the google maps always loads for us; so really don't know what the issue is.
We use a separate js file linked to our html
An example of the js is:
var map = null;
function initialize() {
var myOptions = {
zoom: 10,
center: new google.maps.LatLng(53.5, -1.78),
mapTypeControl: false,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.TERRAIN
}
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
// Add marker to the map
var point = new google.maps.LatLng(53.34932, -1.56504);
var marker = createMarker(point,'1. Blacka Moor<br>An excursion onto the Moors west of Sheffield and making the most of the fine riding in the area - a bona fide Peak District Mountain Biking Classic.<br>Route Grade: medium. Distance: 16.5km')
}
var infowindow = new google.maps.InfoWindow({
size: new google.maps.Size(150, 50),
maxWidth: 300
});
function createMarker(latlng, html) {
var contentString = html;
var marker = new google.maps.Marker({
position: latlng,
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map,marker);
});
}
and in our html head we have:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<style type="text/css">
html, body { height: 100%; }
</style>
<script type="text/javascript" src="assets/googlemapscripts/darkpeakscript.js"></script>
<script type="text/javascript">
window.onload = function () {
initialize();
}
</script>
and in the body
<div id="map_canvas" style="width: 630px; height: 450px; font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; font-size: 0.8em;"></div>
Thanks Rich
Upvotes: 1
Views: 322
Reputation: 1667
My assumption is that googlebot won't fully evaluate all code on page, but will use heuristics as well. Base on this assumption I did the following:
Create a div with a "random" ID (for the map) and style="display: none;"
Create a noscript tag with an img tag in it with the SAME "random" ID (i used a static map image as fallback here)
Create a (custom) javascript function where the unique ID must be passed to initialize your map AND toggle the display on the map-element.
So far, none of the maps "sorry we have no imagery" gets indexed.
Upvotes: 1