From 59359ce62be7d3f826cb9a56aa05a08a15aa788e Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Fri, 22 Dec 2017 07:37:17 +0100 Subject: [PATCH] Add support for multilingual page --- _config.yml | 3 +++ _includes/menu.html | 2 ++ _layouts/page.html | 7 +++++++ assets/css/index.css | 5 +++++ index.md | 2 ++ mumble.md | 2 ++ 6 files changed, 21 insertions(+) diff --git a/_config.yml b/_config.yml index 4e08ea0..9ea58be 100644 --- a/_config.yml +++ b/_config.yml @@ -4,3 +4,6 @@ defaults: path: "" values: layout: "page" +langs: + de: "Deutsch" + en: "English" diff --git a/_includes/menu.html b/_includes/menu.html index 3eef7e7..14a21ce 100644 --- a/_includes/menu.html +++ b/_includes/menu.html @@ -1,9 +1,11 @@ {% for node in site.pages %} +{% if node.lang == page.lang %} {% if node.url == page.url %}
  • {{ node.menutitle }}
  • {% else %}
  • {{ node.menutitle }}
  • {% endif %} +{% endif %} {% endfor %}
  • Git
  • Wiki
  • diff --git a/_layouts/page.html b/_layouts/page.html index a0d28cd..fd7d34e 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -1,6 +1,13 @@ {% include header.html %}
    +
    + {% assign translations = site.pages | where: "ref", page.ref | sort: 'lang' %} + {% for node in translations %} + {{ site.langs[node.lang] | escape }} + {% endfor %} +
    + {{ content }}
    diff --git a/assets/css/index.css b/assets/css/index.css index adf8cab..67fb98a 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -122,6 +122,11 @@ body { .whitebox h2 { color: #1eb513; font-size: 1.5em; } .whitebox h3 { color: #1eb513; font-size: 1em; } +.whitebox .lang-list { + font-size: 0.8rem; + text-align: center; +} + .sidebar .boxhead { font-size:1.1rem; text-transform: uppercase; diff --git a/index.md b/index.md index db4571a..bbd6915 100644 --- a/index.md +++ b/index.md @@ -1,6 +1,8 @@ --- title: The friendly neighborhood undead tech community menutitle: Startseite +lang: de +ref: home --- # Willkommen bei Zombi diff --git a/mumble.md b/mumble.md index ee2a0cb..bddb674 100644 --- a/mumble.md +++ b/mumble.md @@ -1,6 +1,8 @@ --- title: Mumble menutitle: Mumble +lang: de +ref: mumble --- # Mumble