Hello,

On one of our sites, we have a multi-domain.
However, when Sitemaps are generated, they only take into account the language, not the domain.

Let me explain :

Main French site (site1)
Secondary French site (site2)
...

Main English site (site3)
Secondary English site (site4)
...

When the cron launches its sitemap generation (or manually):

Site map of site 1 contains well the url of the domain of the site1
Site Site 2 site contains url with start beginning with site domain1

Site map of site 3 contains well the url of the domain of the site3
Site site 4 site contains url with start beginning with site domain3

So, after several tests, I found a solution:

File xmlsitemap.admin.inc
Line 64 (We suppress)
$sitemap->url = url($sitemap->uri['path'], $sitemap->uri['options']);

Line 64 (We replace it)

$url = $sitemap->uri['options']['base_url'] . '/' . $sitemap->uri['path'];
$sitemap->url = url($url);

File xmlsitemap.generate.inc
Line 160 (we add)
$url_base = $sitemap->uri['options']['base_url'];

Line 196 (We suppress)
$link_url = url($link['loc'], $link_options + $url_options);

Line 196 (We replace it)
$link_url = $url_base . '/' . $link['loc'];

Line 321 (We suppress)
$context['message'] = t('Now generating %sitemap-url.', array('%sitemap-url' => url('sitemap.xml', $sitemap->uri['options'] + array('query' => array('page' => $sitemap->chunks)))));

Line 321 (We replace it)

$url = $sitemap->uri['options']['base_url'] . '/' . $sitemap->uri['path'];
$context['message'] = t('Now generating %sitemap-url.', array('%sitemap-url' => url($url)));

Line 354 (We suppress)
$context['message'] = t('Now generating sitemap index %sitemap-url.', array('%sitemap-url' => url('sitemap.xml', $sitemap->uri['options'])));

Line 354 (We replace it)

$url = $sitemap->uri['options']['base_url'] . '/' . $sitemap->uri['path'];
$context['message'] = t('Now generating sitemap index %sitemap-url.', array('%sitemap-url' => url($url)));

And everything works better.

Patch attached. Tell me if it is well created thank you, it is a first :)

Thank you

Pauline

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Asrahzarh created an issue. See original summary.

Asrahzarh’s picture

Title: Problème SiteMap avec multidomain » Problem SiteMap with multidomain
Issue summary: View changes
FileSize
2.73 KB