Browse Source

Add support for multilingual page

master
madmaurice 4 years ago
parent
commit
59359ce62b
  1. 3
      _config.yml
  2. 2
      _includes/menu.html
  3. 7
      _layouts/page.html
  4. 5
      assets/css/index.css
  5. 2
      index.md
  6. 2
      mumble.md

3
_config.yml

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

2
_includes/menu.html

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

7
_layouts/page.html

@ -1,6 +1,13 @@
{% include header.html %}
<div class="medium-12 columns content-box">
<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 }}
</div>
</div>

5
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;

2
index.md

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

2
mumble.md

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

Loading…
Cancel
Save