I am trying to generate a sitemap, which works just fine if I do it in a standard xml file. The problem I am facing is that I need to generate a xml sitemap within twig file.
So i have this file: sitemap.xml.twig with this content:
{{ <?xml version="1.0" encoding="UTF-8"?> }}
{{ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> }}
{{ <url> }}
{{ <loc>http://www.example.com/</loc> }}
{{ <lastmod>2005-01-01</lastmod> }}
{{ <changefreq>monthly</changefreq> }}
{{ <priority>0.8</priority> }}
{{ </url> }}
{{ </urlset> }}
But I get an error: "message":"Unexpected token
how can i make xml go into twig...? sorry I am new to twig