Search code examples
symfony6sitemap.xml

Sitemap Routing in Symfony 6


I want to make a sitemap in symfony 6 but I don't know how to do the routing.

symfony 5.
 /**
     * @Route("/sitemap.xml", name="sitemap", **defaults={"_format"="xml"**})
     */

Symfony 6.
  #[Route('/sitemap', name: 'app_sitemap', ?...)]

thanks you.


Solution

  • The Route class has various parameters to the constructor, such as default: ['_format' => 'xml'].

    The https://github.com/prestaconcept/PrestaSitemapBundle May also greatly assist.