~rostiger/anchors

anchors/src/sitemap.njk -rw-r--r-- 809 bytes
62b15b41rostiger Binary File difference 2 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
navi:
  key: sitemap
  parent: nchrs
  order: 60
  excerpt: Content overview of this website.
---
{% macro renderNavListItem(entry) -%}
<li>
  {%- if entry.altTitle -%}
    {% set title = entry.altTitle %}
  {%- else -%}
    {% set title = entry.key | safe | splitWords | capitalize %}
  {%- endif -%}
  <a href="{{ entry.url | url }}">{{ title }}</a>
{%- if entry.children.length -%}
  <ul>
    {%- if entry.reverse %}
      {%- for child in entry.children | reverse %}{{ renderNavListItem(child) }}{% endfor -%}
    {%- else %}
      {%- for child in entry.children %}{{ renderNavListItem(child) }}{% endfor -%}
    {%- endif -%}
  </ul>
{%- endif -%}
</li>
{%- endmacro %}

<ul>
{% set navPages = collections.all | navi %}
{%- for entry in navPages %}{{ renderNavListItem(entry) }}{%- endfor -%}
</ul>