Add support for multilingual page

This commit is contained in:
madmaurice 2017-12-22 07:37:17 +01:00
parent 6bf5aa707f
commit 59359ce62b
6 changed files with 21 additions and 0 deletions

View file

@ -4,3 +4,6 @@ defaults:
path: "" path: ""
values: values:
layout: "page" layout: "page"
langs:
de: "Deutsch"
en: "English"

View file

@ -1,9 +1,11 @@
{% for node in site.pages %} {% for node in site.pages %}
{% if node.lang == page.lang %}
{% if node.url == page.url %} {% if node.url == page.url %}
<li><a href="{{ node.url }}" class="is-active">{{ node.menutitle }}</a></li> <li><a href="{{ node.url }}" class="is-active">{{ node.menutitle }}</a></li>
{% else %} {% else %}
<li><a href="{{ node.url }}">{{ node.menutitle }}</a></li> <li><a href="{{ node.url }}">{{ node.menutitle }}</a></li>
{% endif %} {% endif %}
{% endif %}
{% endfor %} {% endfor %}
<li><a href="https://git.zom.bi/explore/projects">Git</a></li> <li><a href="https://git.zom.bi/explore/projects">Git</a></li>
<li><a href="https://wiki.zom.bi/">Wiki</a></li> <li><a href="https://wiki.zom.bi/">Wiki</a></li>

View file

@ -1,6 +1,13 @@
{% include header.html %} {% include header.html %}
<div class="medium-12 columns content-box"> <div class="medium-12 columns content-box">
<div class="whitebox"> <div class="whitebox">
<div class="lang-list">
{% assign translations = site.pages | where: "ref", page.ref | sort: 'lang' %}
{% for node in translations %}
<a href="{{ node.url }}">{{ site.langs[node.lang] | escape }}</a>
{% endfor %}
</div>
{{ content }} {{ content }}
</div> </div>
</div> </div>

View file

@ -122,6 +122,11 @@ body {
.whitebox h2 { color: #1eb513; font-size: 1.5em; } .whitebox h2 { color: #1eb513; font-size: 1.5em; }
.whitebox h3 { color: #1eb513; font-size: 1em; } .whitebox h3 { color: #1eb513; font-size: 1em; }
.whitebox .lang-list {
font-size: 0.8rem;
text-align: center;
}
.sidebar .boxhead { .sidebar .boxhead {
font-size:1.1rem; font-size:1.1rem;
text-transform: uppercase; text-transform: uppercase;

View file

@ -1,6 +1,8 @@
--- ---
title: The friendly neighborhood undead tech community title: The friendly neighborhood undead tech community
menutitle: Startseite menutitle: Startseite
lang: de
ref: home
--- ---
# Willkommen bei Zombi # Willkommen bei Zombi

View file

@ -1,6 +1,8 @@
--- ---
title: Mumble title: Mumble
menutitle: Mumble menutitle: Mumble
lang: de
ref: mumble
--- ---
# Mumble # Mumble