## title = "Sitemap" url = "/sitemap.xml" [resources] headers[Content-Type] = 'application/xml' [section sitemap] handle = "Site\Menus" identifier = "slug" value = "sitemap" == {% if sitemap is empty %} {% do abort(500, "A menu definition with code 'sitemap' was not found. Please create this menu in the Admin Panel using the Content → Menus page.") %} {% endif %} {% macro render_sitemap_item(item, reference, isRoot) %} {% import _self as nav %} {% set hideRootItem = isRoot and item.replace %} {% if reference.url and not hideRootItem %} {{ reference.url }} {{ reference.mtime|date('c') }} {{ item.changefreq }} {{ item.priority }} {#- Multisite implementation -#} {% if reference.sites %} {% for site in reference.sites %} {% endfor %} {% endif %} {% endif %} {#- Render child items -#} {% if reference.items %} {% for child in reference.items %} {{ nav.render_sitemap_item(item, child) }} {% endfor %} {% endif %} {% endmacro %} {% import _self as nav %} {% for item in sitemap.items %} {{ nav.render_sitemap_item( item, link(item.reference, { nesting: item.nesting, sites: true }), true ) }} {% endfor %}