diff --git a/_data/languages.yml b/_data/languages.yml index 99124e3..ea5b9c9 100644 --- a/_data/languages.yml +++ b/_data/languages.yml @@ -1,6 +1,9 @@ +# cta = call to action (used when prompting user their language is available) + - code: en name: English (UK) cta: This book is available in English + - code: it name: Italiano cta: Questo libro รจ disponibile in italiano diff --git a/_layouts/base.html b/_layouts/base.html new file mode 100644 index 0000000..6e02eee --- /dev/null +++ b/_layouts/base.html @@ -0,0 +1,24 @@ +--- +layout: compress +--- + + + + + {% if page.homepage %}{% else %}{{ page.title }} - {% endif %}Minetest Modding Book + + + + + + + + + + + +
+ {{ content }} +
+ + diff --git a/_layouts/default.html b/_layouts/default.html index 635f2ee..83222ae 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,90 +1,75 @@ --- -layout: compress +layout: base --- - - - - {% if page.homepage %}{% else %}{{ page.title }} - {% endif %}Minetest Modding Book - - - - - - +{% assign pathsplit = page.path | split: '/' %} - - - - - {% assign pathsplit = page.path | split: '/' %} +{% assign language = pathsplit[0] %} - {% assign language = pathsplit[0] %} +{% if language == "_it" %} + {% assign language = "it" %} + {% assign links = site.it | sort: "idx" %} +{% else %} + {% assign language = "en" %} + {% assign links = site.en | sort: "idx" %} +{% endif %} - {% if language == "_it" %} - {% assign language = "it" %} - {% assign links = site.it | sort: "idx" %} - {% else %} - {% assign language = "en" %} - {% assign links = site.en | sort: "idx" %} - {% endif %} +{% assign num = 0 %} - {% assign num = 0 %} + +
+
+ + Choose a language + {{ language }} + -
-
- {% if page.no_header %}{% else %}

{{ page.title }}

{% endif %} - {{ content }} -
+ {% 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 %} - {% 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 %} + - - - - -
- - - - + + diff --git a/_sass/_main.scss b/_sass/_main.scss index a01248b..d800709 100644 --- a/_sass/_main.scss +++ b/_sass/_main.scss @@ -83,6 +83,24 @@ article { // text-align: justify; } +.language-switcher { + display: flex; + align-items: center; + float: right; + color: black; + text-decoration: none; + padding-top: 0.3rem; + + img, span { + display: inline-block; + } + + img { + height: 1.2em; + padding-right: 0.3em; + } +} + footer { margin: 0 0 20px 0; padding: 1em 1.5em; diff --git a/languages.html b/languages.html new file mode 100644 index 0000000..949b052 --- /dev/null +++ b/languages.html @@ -0,0 +1,24 @@ +--- +title: Languages +layout: base +root: . +--- + +
+
+

Minetest Modding Book

+ +

Choose a Language

+ + + +
+ + +
diff --git a/static/languages.svg b/static/languages.svg new file mode 100644 index 0000000..88d3bc6 --- /dev/null +++ b/static/languages.svg @@ -0,0 +1 @@ + \ No newline at end of file