Google Sitemaps With Images

I was able to add extra fields for the sitemap generator.

like:



[url=“Image Sitemaps | Google Search Central  |  Documentation  |  Google Developers”]https://support.google.com/webmasters/answer/178636[/url]

[size=3]

For each URL you list in your Sitemap, add additional information about important images on that page. The following example shows a Sitemap entry for the URL http://example.com/sample.html, which contains two images. (You can list up to 1,000 images for each page.)[/size]


www.sitemaps.org - /schemas/sitemap/0.9/”

xmlns:image=“Image Sitemaps”>



http://example.com/sample.html

image:image

image:lochttp://example.com/image.jpg



image:image

image:lochttp://example.com/photo.jpg











But how can I include the image path?

Solved with help of Simtechdev

how?

Here the answer of them:



[color=#6B6B6B][font=proximanova_light, Tahoma, Arial, Helvetica, sans-serif]You need to make changes in “fn_google_sitemap_print_item_info”.[/font][/color]

[color=#6B6B6B][font=proximanova_light, Tahoma, Arial, Helvetica, sans-serif]app\addons\google_sitemap[/font][/color]

function fn_google_sitemap_print_item_info($links, $lmod, $frequency, $priority, $item_id = '', $item_type = '')

{

//[changes]

$image = '';

if (!empty($item_type) && $item_id != '') {

$i_pair = fn_get_image_pairs($item_id, $item_type, 'M', true, true, DESCR_SL);

if (!empty($i_pair['detailed']['http_image_path'])) {

$link = $i_pair['detailed']['http_image_path'];

$image = “image:imageimage:loc$link”;

}

}

//[/changes]



$item = '';

foreach ($links as $link) {

$link = fn_html_escape($link);

$item .= <<


$link

$lmod

$frequency

$priority

$image

\n

ITEM;

}



return $item;

}





[color=#6B6B6B][font=proximanova_light, Tahoma, Arial, Helvetica, sans-serif]Also you need to make changes for each item (category - $category, products - $product['product_id']) in the function “fn_google_sitemap_get_content” similar to:[/font][/color]

$item = fn_google_sitemap_print_item_info($links, $lmod, $sitemap_settings['products_change'], $sitemap_settings['products_priority'], $product['product_id'], 'product');

Thank you for sharing.

thanks

I needed to add the image namespace to get it to work.



xmlns:image=“Image Sitemaps



Example of mine.





$simple_head = <<


www.sitemaps.org - /schemas/sitemap/0.9/”

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xmlns:image=“Image Sitemaps

xsi:schemaLocation=“www.sitemaps.org - /schemas/sitemap/0.9/

http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd”>



HEAD;





Steve