In certain conditions, the following error occurs while generating the sitemap at /sitemap.xml

Message	Notice: Undefined variable: context in Drupal\xmlsitemap\Controller\XmlSitemapController->renderSitemapXml() (line 76 of /var/www/project/web/modules/contrib/xmlsitemap/src/Controller/XmlSitemapController.php) 

This happens when I have the Enable developer mode to expose additional settings. Button checked. This button can be found in the Setting Tab -> Under Advanced Settings.

When I Uncheck the box and use the sitemap, it works fine.

Any ideas?


jonnyeom created an issue. See original summary.’s picture

Replaced undefined variable $context with $sitemap->getContext() method.

ytsurk’s picture

Works fine for me.

G42’s picture

I can not replicate this problem, have you tried the latest version?