Jump to content

Recommended Posts

Hi to all,

 

I'm working a few days to improve the default sitemap v1.6 once it seems to have some errors in it.

 

My website has some traffic and the images are not indexed by Google, even when i try the search site:mywebsite.com.

 

First of all i think sitemap should have all product images, i found one module by Presta Changeo that have this feature, but unfortunately it makes 1 <URL> for each image. Resuming, if you have 10 images in one product, the module insert 10 times the same product in sitemap with one image each.

 

It should be a feature, put all image:image inside same <url> tag.

 

Now, i checked all my content and saw that Google dont index images from your website if you use media servers because, the sitemap.php file uses getImage and it get the image link from media server.

 

I made a small mod to pass this problem because i dont know how to do it better. Who is using media servers and who have images indexed from media servers? Can i see examples?

 

private function _addSitemapNodeImage($xml, $product)
{
 setlocale(LC_CTYPE, 'pt_BR.utf8');
 $link = new Link();
 $image = $xml->addChild('image', null, 'http://www.google.com/schemas/sitemap-image/1.1');
    $domain  = Configuration::get('PS_SHOP_DOMAIN');
    $shopUrl  = 'http://'.$domain.'/';
    $imgid  = $product['id_image'];
    $imglegend  = preg_replace('/(&+)/i', '&', $product['legend_image']);
 $imgrewrite = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $imglegend);
    $imgrewrite = str_replace(".","",$imgrewrite);
 $imgrewrite = str_replace(" ","-",$imgrewrite);
 $imgrewrite = strtolower($imgrewrite);
    $imgUrl  = $shopUrl.$imgid.'/'.$imgrewrite.'.jpg';
 $image->addChild('loc', $imgUrl, 'http://www.google.com/schemas/sitemap-image/1.1');

 $legend_image = preg_replace('/(&+)/i', '&', $product['legend_image']);
 $image->addChild('caption', $legend_image, 'http://www.google.com/schemas/sitemap-image/1.1');
 $image->addChild('title', $legend_image, 'http://www.google.com/schemas/sitemap-image/1.1');
}

 

Hope someone can help here regarding all images in same URL:loc

 

Thanks

 

Mozack

Link to comment
Share on other sites

×
×
  • Create New...