Support article translation
This commit is contained in:
parent
a6f12ec781
commit
1802e84241
5 changed files with 24 additions and 1 deletions
|
@ -166,6 +166,15 @@ main {
|
|||
color: @header-text-color;
|
||||
font-size: 0.86em;
|
||||
}
|
||||
|
||||
.translations {
|
||||
float: right;
|
||||
|
||||
.lang-current {
|
||||
color: @white;
|
||||
background-color: @grey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
code, kbd, samp, pre {
|
||||
|
|
2
static/stylesheet/style.min.css
vendored
2
static/stylesheet/style.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -13,6 +13,8 @@
|
|||
{% block content %}
|
||||
<article class="single">
|
||||
<header>
|
||||
{% import 'partial/translations.html' as translations with context %}
|
||||
{{ translations.translations_for(article) }}
|
||||
<h1 id="{{ article.slug }}">{{ article.title }}</h1>
|
||||
<p>
|
||||
{{ _('Posted on %(when)s in %(category)s',
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
{% block content %}
|
||||
<article class="single">
|
||||
<header>
|
||||
{% import 'partial/translations.html' as translations with context %}
|
||||
{{ translations.translations_for(page) }}
|
||||
<h1 id="{{ page.slug }}">{{ page.title }}</h1>
|
||||
</header>
|
||||
<div>
|
||||
|
|
10
templates/partial/translations.html
Normal file
10
templates/partial/translations.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% macro translations_for(article) %}
|
||||
{% if article.translations %}
|
||||
<div class="translations">
|
||||
<span class="lang lang-current">{{article.lang}}</span>
|
||||
{% for translation in article.translations %}
|
||||
<a class="lang" href="{{ SITEURL }}/{{ translation.url }}">{{ translation.lang }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
Loading…
Reference in a new issue