wiki/_layouts/wiki.html
2021-01-03 00:38:17 -06:00

76 lines
2.7 KiB
HTML

---
layout: compress
---
<!DOCTYPE html>
<html lang="{{ page.collection | default: "en-US" }}" {% if site.rtl contains page.collection %}dir="rtl"{% endif %}>
{% include head.html%}
<body>
<div class="content">
{% include nav.html %}
<main>
<div class="container-fluid main-content">
{% include language-alert.html %}
<div class="row pt-5">
<div class="col-sm-3">
<div class="rounded-3 border sidebar-container mb-3 p-3">
<!-- get category list -->
{% assign items = site[page.collection] | where: "section", page.section | sort_natural: "title" %}
{% for item in items %}
{% if item.category.first %}
{% assign list = item.category %}
{% else %}
{% assign list = item.category | split: "don't split, i just want an array. this shouldn't be in a string." %}
{% endif %}
{% assign categories = categories | concat: list %}
{% endfor %}
{% assign categories = categories | uniq | sort_natural %}
<ul class="list-unstyled">
<!-- First do the index -->
{% for item in items %}
{% if item.url contains "index.html" %}
<li class="li-bullet {% if page.title == item.title %}fw-bold{% endif %}"><a href="{{ item.url | remove: ".html" }}">{{ item.title }}</a></li>
{% endif %}
{% endfor %}
<!-- Then the pages not in categories -->
{% for item in items %}
{% unless item.url contains "index.html" or item.category %}
<li class="li-bullet {% if page.title == item.title %}fw-bold{% endif %}"><a href="{{ item.url | remove: ".html" }}">{{ item.title }}</a></li>
{% endunless %}
{% endfor %}
<!-- Finally, the other pages -->
{% for cat in categories %}
<li>
<details {% if page.category == cat or page.category.first and page.category contains cat %}open{% endif %}>
<summary>{{ cat }}</summary>
<ul>
{% for item in items %}
{% unless item.category == cat or item.category.first and item.category contains cat %}
{% continue %}
{% endunless %}
<li class="{% if page.title == item.title %}fw-bold{% endif %}"><a href="{{ item.url | remove: ".html" }}">{{ item.title }}</a></li>
{% endfor %}
</ul>
</details>
</li>
{% endfor %}
</ul>
</div>
</div>
<div class="col-sm-9">
<h1>{{ page.title }}</h1>
<hr>
{% include anchor-headings.html html=content anchorBody="<small>#</small>" anchorClass="header-anchor" %}
</div>
</div>
</div>
</main>
</div>
{% include footer.html %}
{% include common-js.html %}
</body>
</html>