minetest_modding_book/_layouts/default.html
2024-01-10 22:31:47 +00:00

75 lines
2.0 KiB
HTML

---
layout: base
---
{% assign pathsplit = page.path | split: '/' %}
{% assign language = pathsplit[0] %}
{% if language == "_it" %}
{% assign language = "it" %}
{% assign links = site.it %}
{% else %}
{% assign language = "en" %}
{% assign links = site.en %}
{% endif %}
{% assign links = links | where_exp: "item", "item.sitemap != false" | sort: "idx" %}
{% assign num = 0 %}
<nav>
{% for link in links %}
{% assign idsplit = link.id | split: '/' %}
{% assign section = idsplit[2] %}
<li>
<a href="{{ page.root }}{{ link.url }}"
class="{% if page.title == link.title %}selected{% endif %}{% if section != last_section and section != 'index' %} hr {% endif %}">
{% if section != "index" %}{{ num }} - {% endif %}
{{ link.title }}
</a>
</li>
{% assign last_section = section %}
{% assign num = num | plus:1 %}
{% endfor %}
<li><a href="https://github.com/rubenwardy/minetest_modding_book/archive/examples.zip" class="hr">Download Examples</a></li>
</nav>
<main>
<article {% if page.homepage %}class="homepage"{% endif %}>
<a href="{{ page.root }}/languages.html" class="language-switcher">
<img src="{{ page.root }}/static/languages.svg" alt="Choose a language">
<span>{{ language }}</span>
</a>
{% if page.no_header %}{% else %}<h1>{{ page.title }}</h1>{% endif %}
{{ content }}
</article>
{% for link in links %}
{% if link.title == page.title %}
{% unless forloop.first %}
{% assign prev = tmpprev %}
{% endunless %}
{% unless forloop.last %}
{% assign next = links[forloop.index] %}
{% endunless %}
{% endif %}
{% assign tmpprev = link %}
{% endfor %}
<ul class="prevnext">
<li>{% if prev %}<a href="{{ page.root }}{{ prev.url}}">&lt; {{ prev.title }}</a>{% endif %}</li>
<li>{% if next %}<a href="{{ page.root }}{{ next.url}}">{{ next.title }} &gt;</a>{% endif %}</li>
</ul>
<footer>
&copy; 2014-{{ site.time | date: '%Y' }}
{% if language == "en" %}
| Helpful? Consider
<a href="https://rubenwardy.com/donate/">donating</a>
to support my work.
{% endif %}
</footer>
</main>