code: public function generateSitemap()
  	{
  		/** @var Symfony\Component\HttpFoundation\Session\SessionInterface $objSession */
  		$objSession = Contao\System::getContainer()->get('session');
  
  		$session = $objSession->get('sitemap_updater');
  
  		if (empty($session) || !\is_array($session))
  		{
  			return;
  		}
  
  		$this->import('Contao\Automator', 'Automator');
  
  		foreach ($session as $id)
  		{
  			$this->Automator->generateSitemap($id);
  		}
  
  		$objSession->set('sitemap_updater', null);
  	}
docs: Check for modified pages and update the XML files if necessary