Hi,

When limiting the number of links to 5000 per sitemap, the sitemapindex generated doesn't contains the loc value.

ex:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/fr/sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><lastmod>2016-12-19T21:04Z</lastmod></sitemap>
<sitemap><lastmod>2016-12-19T21:04Z</lastmod></sitemap>
</sitemapindex>

instead of :

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/fr/sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>http://my.dev/sitemap.xml?page=1</loc><lastmod>2016-12-19T21:39Z</lastmod></sitemap>
<sitemap><loc>http://my.dev/sitemap.xml?page=2</loc><lastmod>2016-12-19T21:39Z</lastmod></sitemap>
</sitemapindex>

In the method generateXML() in XmlSitemapIndexWriter an array element per chunk is created with an Url Object as value fo 'loc'.
So a little farther in code an Url Object is passed to XMLWriter::writeElement who needs strings in args.

I suggest calling the toString() method on the Url.

Comments

romsP created an issue. See original summary.

romsP’s picture

romsP’s picture

Issue summary: View changes
romsP’s picture

Status: Active » Needs review
orphans’s picture

Confirmed I'm having the same issue on both the alpha and dev branches. Going to give your patch a try.

sch4lly’s picture

Your patch does not apply from the module directory, the paths are wrong. I changed it and now it works. Thanks!

romsP’s picture

Thank you sch4lly,

I missed that point and took the time to read the General patch guidelines for next time.

Thanks :)

Status: Needs review » Needs work

The last submitted patch, 6: xmlsitemap-sitemapindex_no_links-2838025.patch, failed testing.

SteffenR’s picture

Status: Needs work » Needs review