Looks like if we have languages enabled by setting different domains (fx, solar.com, solar.de, solar.dk etc..) for different languages, then accessing generated sitemap fx., http://solar.com/sitemap.xml
we see such links:
http://default/http://solar.com/node/100
http://default/http://solar.com/node/101
http://default/http://solar.com/node/102

where "http://default" is the "Default base URL".

We would like to have this field not used if domains are set in language settings and also we would like to have different sitemaps for each language, so that:

http://solar.com/sitemap.xml - provides links to EN language content with domain http://solar.com
http://solar.de/sitemap.xml - provides links to DE language content with domain http://solar.de
etc..

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

evaldask created an issue. See original summary.

evaldask’s picture

I've looked at the latest dev version - content urls were already fixed, but there's still an issue to get the sitemap.xml loaded with different language.

Trying to access DK version http://solar.dk/sitemap.xml Firefox shows:
Error loading stylesheet: An unknown error has occurred (805303f4)
http://solar.com/sitemap.xsl
Chrome displays white window.

Sitemaps were generated with admin in http://solar.com/admin/config/search/xmlsitemap

Sitemap is not loaded because http://solar.dk/sitemap.xml loads xml with this line
<?xml-stylesheet type="text/xsl" href="http://solar.com/sitemap.xsl"?>

it should be
<?xml-stylesheet type="text/xsl" href="http://solar.dk/sitemap.xsl"?>

I've added patch for that.

poukram’s picture

Status: Needs review » Reviewed & tested by the community

thanks guys, the last patch with good paths works fine!

juampynr’s picture

+++ b/src/XmlSitemapWriter.php
@@ -121,7 +121,19 @@ public function startDocument($version = '1.0', $encoding = 'UTF-8', $standalone
+        $xls_url = Url::fromRoute('xmlsitemap.sitemap_xsl');

Can we move this up so we call fromRoute just once?

Also, can you provide steps to reproduce this issue? With them we may be able to write a test that proves the bug.

juampynr’s picture

Status: Reviewed & tested by the community » Needs work
hswong3i’s picture

hswong3i’s picture

Status: Needs review » Reviewed & tested by the community

I had been using this patch for more than a year and error gone as expected, should be good enough for RTBC?

alex_optim’s picture

+1

pifagor’s picture

  • pifagor committed 51f9ed4 on 8.x-1.x authored by hswong3i
    Issue #2815631 by evaldask, hswong3i, SylvainM, juampynr, alex_optim,...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed
hkirsman’s picture

I have the latest dev version but the output of sitemap.xml is still:

Sitemap file: http://local.developer.tekla.com/sitemap.xml
Number of sitemaps in this index: 2

Sitemap URL	Last modification date
http://default//sitemap.xml?page=2	2018-09-22T19:57Z
http://default//sitemap.xml?page=1	2018-09-22T19:57Z
Generated by the Drupal XML sitemap module.

Is this another bug?

hkirsman’s picture

Sorry, I have to set the domain from UI. Interesting.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.