Add previous/next links to bottom of page

Fixes #62
This commit is contained in:
rubenwardy 2018-07-15 15:50:35 +01:00
parent 1ca3ba1e82
commit 5ee799b76b
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
4 changed files with 121 additions and 63 deletions

View File

@ -1,15 +0,0 @@
</article>
<footer>
&copy; 2014-8 |
<a href="https://creativecommons.org/licenses/by-sa/3.0/">License</a> |
Helpful? Consider
<a href="https://rubenwardy.com/donate/">donating</a>
to support my work.
</footer>
</article>
</main>
<link rel="stylesheet" href="{{ page.root }}static/style.css">
<script async src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script async src="{{ page.root }}static/script.js"></script>
</body>
</html>

View File

@ -1,45 +0,0 @@
<!doctype html>
<html>
<head>
<title>{% if page.homepage %}{% else %}{{ page.title }} - {% endif %}Minetest Modding Book</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="description" content="An easy guide to learn how to create mods for Minetest">
<meta name="keywords" content="Minetest, modding, book, tutorial, guide, easy">
<meta name="author" content="rubenwardy">
<style>body,html,nav{background:#333}nav,nav li,nav li a{display:block}body,html,main,nav li{margin:0;padding:0}main,nav{position:absolute;top:0}body,html{font-size:17px;color:#000}#container{width:100%;max-width:1100px;margin:auto;position:relative}nav{left:0;width:280px;list-style:none;color:#fff}nav li a{padding:5px;color:#ccc;text-decoration:none}main{left:280px;right:0}article{background:#fff;padding:0 20px 20px}</style>
</head>
<body>
{% assign pathsplit = page.dir | split: '/' %}
{% assign language = pathsplit[1] %}
{% if language == "en" %}
{% assign links = site.en | sort: "idx" %}
{% else %}
{% assign language = "en" %}
{% assign links = site.en | sort: "idx" %}
{% endif %}
{% assign num = 0 %}
<div id="container">
<nav>
{% for link in links %}
{% assign idsplit = link.id | split: '/' %}
{% assign section = idsplit[2] %}
<li><a href="{{ 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="{{ page.root }}lua_api.html" class="hr">Lua Modding API Reference</a></li>
<li><a href="https://github.com/rubenwardy/minetest_modding_book/archive/examples.zip">Download Examples</a></li>
</nav>
<main>
<article {% if page.homepage %}class="homepage"{% endif %}>
{% if page.no_header %}{% else %}<h1>{{ page.title }}</h1>{% endif %}

View File

@ -1,6 +1,83 @@
---
layout: compress
---
{% include header.html %}
{{ content }}
{% include footer.html %}
<!doctype html>
<html>
<head>
<title>{% if page.homepage %}{% else %}{{ page.title }} - {% endif %}Minetest Modding Book</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="description" content="An easy guide to learn how to create mods for Minetest">
<meta name="keywords" content="Minetest, modding, book, tutorial, guide, easy">
<meta name="author" content="rubenwardy">
<style>body,html,nav{background:#333}nav,nav li,nav li a{display:block}body,html,main,nav li{margin:0;padding:0}main,nav{position:absolute;top:0}body,html{font-size:17px;color:#000}#container{width:100%;max-width:1100px;margin:auto;position:relative}nav{left:0;width:280px;list-style:none;color:#fff}nav li a{padding:5px;color:#ccc;text-decoration:none}main{left:280px;right:0}article{background:#fff;padding:0 20px 20px}</style>
</head>
<body>
{% assign pathsplit = page.dir | split: '/' %}
{% assign language = pathsplit[1] %}
{% if language == "en" %}
{% assign links = site.en | sort: "idx" %}
{% else %}
{% assign language = "en" %}
{% assign links = site.en | sort: "idx" %}
{% endif %}
{% assign num = 0 %}
<div id="container">
<nav>
{% for link in links %}
{% assign idsplit = link.id | split: '/' %}
{% assign section = idsplit[2] %}
<li><a href="{{ 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="{{ page.root }}lua_api.html" class="hr">Lua Modding API Reference</a></li>
<li><a href="https://github.com/rubenwardy/minetest_modding_book/archive/examples.zip">Download Examples</a></li>
</nav>
<main>
<article {% if page.homepage %}class="homepage"{% endif %}>
{% 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="{{ prev.url}}">&lt; {{ prev.title }}</a>{% endif %}</li>
<li>{% if next %}<a href="{{ next.url}}">{{ next.title }} &gt;</a>{% endif %}</li>
</ul>
<footer>
&copy; 2014-8 |
Helpful? Consider
<a href="https://rubenwardy.com/donate/">donating</a>
to support my work.
</footer>
</article>
</main>
<link rel="stylesheet" href="{{ page.root }}static/style.css">
<script async src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script async src="{{ page.root }}static/script.js"></script>
</body>
</html>

View File

@ -81,3 +81,44 @@ h3 {
.toc > ul > li > ul > li > ul {
display: none;
}
.prevnext {
display: flex;
list-style: none;
margin: 0 auto;
padding: 0;
background: #eee;
li {
display: inline-block;
list-style: none;
margin: 0;
padding: 0;
flex: 1;
a {
display: block;
margin: 0;
padding: 1em 0;
text-align: center;
font-size: 100%;
text-decoration: none;
color: black;
}
a:hover {
text-decoration: none;
background: #fff;
}
}
li:first-child {
border-right: 2px solid white;
}
li:last-child {
border-left: 2px solid white;
}
}