Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The sitemap.xml file is missing the tags.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><lastmod>2017-09-28T12:34Z</lastmod></sitemap>
<sitemap><lastmod>2017-09-28T12:34Z</lastmod></sitemap>
</sitemapindex>
I also got the following warning
XMLWriter::writeElement() expects parameter 2 to be string, object given XmlSitemapWriter.php:210
I was able to fix this by change line 55 in src/XmlSitemapIndexWriter.php from
'loc' => Url::fromRoute('xmlsitemap.sitemap_xml', [], $url_options),
to
'loc' => Url::fromRoute('xmlsitemap.sitemap_xml', [], $url_options)->toString(),
Url::fromRoute returns an object while we need a string there.
Comment | File | Size | Author |
---|---|---|---|
#2 | sitemap_xml_index-2912413-2.patch | 674 bytes | renatog |
Comments
Comment #2
renatogHi @drone.ah, how are you?
Make sense.
In attachment the patch with the fix.
Regards.
Comment #4
renatogFixed.
Committed to the dev branch.
We are going to generate a new release soon.
Thank you very much @drone.ah for your contribution.
Regards.