mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Show translated content directly on index page (#693)
instead of only providing a 'Community Translation' link
This commit is contained in:
committed by
GitHub
parent
b31b2af58b
commit
60ce0e0cd4
@@ -102,8 +102,9 @@ main img {
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-translation {
|
.no-translation {
|
||||||
margin-top: .3rem;
|
margin-top: .3rem;
|
||||||
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-category {
|
.post-category {
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
{% macro post_link(page) %}
|
{% macro post_link(page) %}
|
||||||
<div>
|
<div>
|
||||||
<h2 class="post-title"><a href="/{{ page.path | safe }}">{{ page.title }}</a></h2>
|
{% set translations = page.translations | filter(attribute="lang", value=lang) %}
|
||||||
|
{% if translations %}
|
||||||
|
{% set post = get_page(path = translations.0.path) %}
|
||||||
|
{% else %}
|
||||||
|
{% set post = page %}
|
||||||
|
{% set not_translated = true %}
|
||||||
|
{% endif %}
|
||||||
|
<h2 class="post-title"><a href="/{{ post.path | safe }}">{{ post.title }}</a></h2>
|
||||||
<div class="post-summary">
|
<div class="post-summary">
|
||||||
{{ page.summary | safe}}
|
{{ post.summary | safe}}
|
||||||
<a class="read-more" href="/{{ page.path | safe }}">read more…</a>
|
<a class="read-more" href="/{{ post.path | safe }}">read more…</a>
|
||||||
|
|
||||||
{% set translations = page.translations | filter(attribute="lang", value=lang) %}
|
{% if not_translated %}
|
||||||
{% if translations %}
|
<aside class="no-translation">
|
||||||
<div class="post-translation">
|
(This post is not translated yet.)
|
||||||
{% set post = translations.0 %}
|
</aside>
|
||||||
<b>Community Translation: <a href="{{ post.permalink }}">{{ post.title }}</a></b>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user