From 5ee799b76bb864388150f0729770743b7d413c34 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 15 Jul 2018 15:50:35 +0100 Subject: [PATCH] Add previous/next links to bottom of page Fixes #62 --- _includes/footer.html | 15 -------- _includes/header.html | 45 ----------------------- _layouts/default.html | 83 +++++++++++++++++++++++++++++++++++++++++-- _sass/_content.scss | 41 +++++++++++++++++++++ 4 files changed, 121 insertions(+), 63 deletions(-) delete mode 100644 _includes/footer.html delete mode 100644 _includes/header.html diff --git a/_includes/footer.html b/_includes/footer.html deleted file mode 100644 index e3a1ec9..0000000 --- a/_includes/footer.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/_includes/header.html b/_includes/header.html deleted file mode 100644 index 846004a..0000000 --- a/_includes/header.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - {% if page.homepage %}{% else %}{{ page.title }} - {% endif %}Minetest Modding Book - - - - - - - - - {% 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 %} - -
- - -
-
- {% if page.no_header %}{% else %}

{{ page.title }}

{% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index 4cc5f9b..e666763 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,6 +1,83 @@ --- layout: compress --- -{% include header.html %} -{{ content }} -{% include footer.html %} + + + + + {% if page.homepage %}{% else %}{{ page.title }} - {% endif %}Minetest Modding Book + + + + + + + + + {% 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 %} + +
+ + +
+
+ {% if page.no_header %}{% else %}

{{ page.title }}

{% endif %} + {{ content }} +
+ + + {% 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 %} + + + +
+ © 2014-8 | + Helpful? Consider + donating + to support my work. +
+
+
+ + + + + diff --git a/_sass/_content.scss b/_sass/_content.scss index 1963491..8b6958a 100644 --- a/_sass/_content.scss +++ b/_sass/_content.scss @@ -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; + } +}