Page 1 of 1

Google sitemap problem (potential)

Posted: Tue Mar 17, 2015 8:53 pm
by jeffz2014
When you have character & (ampersand, or any other xml entity) in your sitemap,
e.g. in image:caption, or image:title e.g. a title like Apples & Oranges,
then your sitemap gets broken and is rejected by Google.

FIX
find: catalog/controller/feed/google_sitemap.php
on or around lines 21 and 22 change:

Code: Select all

$product['name']
//to 
htmlspechalchars($product['name'])
Sometimes some element from xml sitemap is missing, sitemap is not well formed, so Webmaster Tools show you that there are errors, but what you get is that all errors are located in line #1 (according to webmasters tootls).
To get some more meaningful reading you can add:

Code: Select all

"\r\n"
//at the end off each line, sample:
//e.g. change:
'<image:caption>' . htmlspecialchars($product['name']) . '</image:caption>';
//to:
'<image:caption>' . htmlspecialchars($product['name']) . '</image:caption>'. "\r\n";
If you do above, webmasters tolls system will show you meaningful lines, where errors are nested.