The i18n module adds 'en' to $context which is used to generate 'smid'. Therefore, if you have sitemaps that were created before enabling i18n they won't be displayed. Typically:

#1 install xmlsitemap

This generates a sitemap as per xmlsitemap.install.

Blank $context language

$sitemap->smid = xmlsitemap_sitemap_get_context_hash($sitemap->context);

/sitemap.xml loads fine.

#2 install xmlsitemap_i18n

Now in xmlsitemap_sitemap_load_by_contxt we have $context[language] = "en"

This is used to generate the hash that we are looking for. Therefore, it doesn't match.

xmlsitemap.install. I think this should call xmlsitemap_get_current_context(); for consistency although it doesn't fix the problem.

xmlsitemap.module - I also think xmlsitemap_sitemap_load_by_context should do something to report that the smid we were looking for was not found. The xmlsitemap files look OK but still no sitemap.xml is frustrating.

The root fix is to ensure that xmlsitemap_get_current_context() is less fragile? Or cause it to cascade backwards. I have a patch with it cascading backwards.

Usually I don't load modules unless I absolutely have to. Therefore, haven't seen this scenario even after a lot of use. Could be related to http://drupal.org/node/1593508.

CommentFileSizeAuthor
xmlsitemap-i18nlost-yy-1.patch1.25 KBinterlated
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Status: Active » Needs review

Here testbot.

jasom’s picture

What is this patch about? I applied it because of #1948480: Language subdomains gives '"Page not found" issue and problem partially disappear:

there is no more Page not found but in generated sitemap for default language are listed also nodes for other domains (languages).

I need site.com/sitemap.xml just with english content.

citywizz’s picture

We must keep in mind that it takes to play on the weight in the language detection

en/admin/config/regional/language/configure

1rst choice : URL Determine the language from the URL (Path prefix or domain).

2nd choice : Default - Use the default site language

Chris Matthews’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +whitespace

xmlsitemap-i18nlost-yy-1.patch:10: trailing whitespace.
// No smid - then at least report it.
xmlsitemap-i18nlost-yy-1.patch:13: trailing whitespace.
// Try without the language.

Checking patch xmlsitemap.module...
Hunk #1 succeeded at 415 (offset 31 lines).
Hunk #2 succeeded at 439 (offset 31 lines).

Applied patch xmlsitemap.module cleanly.
warning: 2 lines add whitespace errors.