-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitemap.html
27 lines (27 loc) · 961 Bytes
/
sitemap.html
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
---
layout: default
title: Site Map
---
<!-- no idea why this include is needed here, shouldn't be -->
{%- include base.html %}
{%- assign olddepth = 0 %}
{%- assign sorted_pages = site.pages | sort_natural: "url" %}
{%- for page in sorted_pages %}
{%- unless page.sitemap_exclude %}
{%- assign depth = page.url | split: '/' | size | minus: 1%}
{%- if depth > olddepth %}
{%- for i in (olddepth .. depth) offset: 1 %} <ul> {% endfor %}
{%- elsif depth < olddepth %}
{%- for i in (depth .. olddepth) offset: 1 %} </ul> {% endfor %}
{%- endif %}
{%- assign last_char = page.url | split: "" | last %}
{%- if last_char == "/" %}
{%- assign filename = "index.html" %}
{%- else %}
{%- assign filename = "" %}
{%- endif %}
<li><a href="{{base}}{{page.url}}{{filename}}">{{page.title}}</a></li>
{%- assign olddepth = depth -%}
{%- endunless -%}
{%- endfor -%}
{%- for d in (1..depth) -%}</ul>{%- endfor -%}