page and translations

master
Marko Semet 2019-05-22 20:05:09 +02:00
parent c8beebdb1f
commit 87cee4043d
4 changed files with 90 additions and 8 deletions

View File

@ -1,17 +1,38 @@
/* Main colors */
body {
color: #110;
color: #000;
}
body > * {
background: #110;
color: #EEF;
background: #000;
color: #FFF;
}
a {
color: #FFF;
text-decoration: underline;
font-style: none;
}
.main1 {
background: #DDE;
color: #110;
background: #FFF;
color: #000;
overflow: hidden;;
}
.main1 a {
color: #000;
}
.main2 {
background: #FFF;
margin: -1em;
}
.main3 {
margin: 0 1em;
padding: 1em 0;
background: #FFF;
box-shadow: 0 0 1em #000;
}
/* Page */
.updated, .translations, .translation a {
color: #888;
}

View File

@ -16,8 +16,21 @@ body > * {
}
.main2 {
height: 100%;
height: calc(100%);
}
.main3 {
display: inline-block;
margin-left: 1em;
margin-right: 1em;
height: calc(100%);
}
/* page */
.page_title {
}
.translations {
float: right;
}
.updated {
font-style: italic;
}

View File

@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block html_lang %}{{ page.lang }}{% endblock %}
{% block title %}{{ SITENAME }} - {{ page.title }}{%endblock%}
{% block head %}
{{ super() }}
{% import 'translations.html' as translations with context %}
{% if translations.entry_hreflang(page) %}
{{ translations.entry_hreflang(page) }}
{% endif %}
{% endblock %}
{% block content %}
<main>
<div class="page_title">
{% import 'translations.html' as translations with context %}
{{ translations.translations_for(page) }}
{{ page.title }}
</div>
{% if page.modified %}
<p style="updated">Zuletzt aktualisiert: {{ page.locale_modified }}</p>
{% endif %}
<article>
{{ page.content }}
</article>
</main>
{% endblock %}

View File

@ -0,0 +1,18 @@
{% macro translations_for(article) %}
{% if article.translations %}
<div class="translations">
<a href="{{ SITEURL }}/{{ article.translations[0].url }}" hreflang="{{ article.translations[0].lang }}">{{ article.translations[0].lang }}</a>
{% for translation in article.translations[1:] %}
/ <a href="{{ SITEURL }}/{{ translation.url }}" hreflang="{{ translation.lang }}">{{ translation.lang }}</a>
{% endfor %}
</div>
{% endif %}
{% endmacro %}
{% macro entry_hreflang(entry) %}
{% if entry.translations %}
{% for translation in entry.translations %}
<link rel="alternate" hreflang="{{ translation.lang }}" href="{{ SITEURL }}/{{ translation.url }}">
{% endfor %}
{% endif %}
{% endmacro %}