I believe I found a bug.
Basically I have two sites, one with the primary language in english and the other one with the primary in Spanish. Both have 2 languages, but just different primary language.
I create sitemaps for each language and for each domain, so I have four total (2 for site A, and 2 for site B) - each one has two languages, but the primary language is different.
When I create the sitemaps, everything works fine, but when I go to rebuild the links, the path prefixes are applied depending on which domain I use to rebuild links.
If I run rebuild links from Site A (english primary) I get a sitemap in english with no path prefix (which is correct) and a sitemap in spanish with prefix /es (which is correct). The problem is that with site B, since they dont have the same primary language, it applies the same path prefixes to the domains. So for Site B I get an /es prefix for my primary language (which is wrong - should be no prefix) and no prefix for my secondary langauge (wrong - should be /en). This wouldnt be a problem if I had the same primary language for all domains, but unfortuantely i dont.
If I run rebuild from Site B, the opposite happens, for site B everything comes out right (primary langauge which is spanish with no prefix and secondary language with /en prefix for english). For site A though, it applies the same results (english with en prefix and spanish with none). This is a problem.
Rather than look at each domain individually, and applying prefixes according to the settings of each (domain locale), it looks at the current domain which the rebuild links is currently running, and applies the path prefix settings from that domain to all of them.
Any help would be appreciated!
Comments
Comment #1
Exploratus commentedI just disabled Multilingual Sitemap and it still happens. Basically, it sets the prefixes for the urls depending on the domain which the links are rebuilt, so in my case, since the domains have different primary language, this creates a problem.
Comment #2
Exploratus commentedIf the domain I am rebuilding links on has english as primary ( no prefix) and spanish as secondary (prefix /es), it does the same thing to my other domain - it makes it english no prefix and spanish prefix /es. THis is bad because I have domain locale and I have different primary languages, so on the second domain it should be english prefix (en) and spanish no prefix.
Rebuilding links takes the settings for the path prefix for the current domain and applies them to all domains, ignoring domain locale settings.
Comment #3
batigol commentedD7.12
XML sitemap 7.x-2.0-rc1
XML sitemap domain 7.x-1.0-beta2
Domain Access 7.x-3.3
Internationalization 7.x-1.4
I need different settings (and different site map) for:
MAIN SITE
subdomain1
subdomain2
and be able to share some links (all of those sites share some content - but make links by source domain is fine).
And I simply CAN'T (or don't know exactly how) achieve it...
Comment #4
jessehsThe following patch adds the ability to alter the link URL: #2053921: Add ability to modify link using hook_xmlsitemap_link_url_alter(&$link_options)
After applying, I added the following function in a custom module:
Note, domain ID 0 is the default domain, so I never need to modify its path language prefix.
I'm marking this as needs review, as I believe it's an adequate solution, since this issue only occurs with so many other customizations.
Comment #5
Anonymous (not verified) commentedThere is no patch to review just suggested code in a comment field. Read the developer documentation and come up with an appropriate patch file to attach. Then mark it for review.
Comment #6
jessehsSorry @earnie, by marking this issue as "needs review", I simply meant that it is the idea of the fix that needs review, as per developer documentation: Status settings for an issue.
What I'm thinking is that this problem only occurs with very specific and advanced contrib-module use/configuration. It should not by xmlsitemap's job to check for Domain Access and default language settings for other domains. If a hook_xmlsitemap_link_url_alter is provided, the other module(s) could fix the issue themselves. Perhaps an issue should be opened up in the Domain Access issue queue, and cross-linked. If the patch linked to in #4 is accepted, perhaps Domain can implement the hook to fix links in domains that have a different default language.
Comment #7
Anonymous (not verified) commentedThat certainly isn't the case with your proposal, a patch file is required and the testbot would get first crack and it.
Comment #8
jessehsThe patch is here: #2053921: Add ability to modify link using hook_xmlsitemap_link_url_alter(&$link_options), and it's Testbot approved :-)
I think the place for the code in #4 might be the domain_xmlsitemap module, since a site might need it anyway in order to integrate Domain Access with this module. (I think if you don't need access control, it might not matter.)
Anyway, I've created an issue with a patch over here: #2054195: Domains with different default language than main domain get language prefix