I'd like to inject the service into a controller so I can create the sitemap list by section.
// @todo: inject the SiteMap service and get the sections.
$sections = [
'',
'default.',
'blog.',
'misc.',
'yml.'
];
return $this->render('default/index.html.twig', [
'sections' => $sections,
'pages' => $pageRepository->findBy([], [], 30)
]);
<h3>Sitemaps</h3>
<ul>
{% for section in sections %}
{% set url = '/sitemap.%sxml'|format(section) %}
<li><a href="{{ url }}">
{{ url }}
</a>
</li>
{% endfor %}