{{!-- views/pages/sitemap.handlebars --}}

{{#section "styles"}}
<link rel="stylesheet" href="{{baseUrl}}/static/css/sitemap.css" />
{{/section}}

{{!-- Inline recursive partial for sitemap nodes --}}
{{#*inline "sitemapNode"}}
<li {{#if children}}class="sitemap-group" {{/if}}>
    {{#if children}}
    <span class="sitemap-section-title">
        {{#if loc}}
        <a href="{{loc}}">{{#if title}}{{title}}{{else}}{{label}}{{/if}}</a>
        {{else}}
        {{#if title}}{{title}}{{else}}{{label}}{{/if}}
        {{/if}}
    </span>
    <ul>
        {{#each children}}
        {{> sitemapNode}}
        {{/each}}
    </ul>
    {{else}}
    <a href="{{loc}}">
        {{#if title}}{{title}}{{else if label}}{{label}}{{else}}{{loc}}{{/if}}
    </a>
    {{#if lastmod}}<span class="sitemap-date">({{lastmod}})</span>{{/if}}
    {{/if}}
</li>
{{/inline}}

<nav class="sitemap">
    <h1>Site Map</h1>
    <ul>
        {{#each sitemap}}
        {{> sitemapNode}}
        {{/each}}
    </ul>
</nav>
