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
@@ -1,16 +1,21 @@
|
||||
{% macro post_link(page) %}
|
||||
<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">
|
||||
{{ page.summary | safe}}
|
||||
<a class="read-more" href="/{{ page.path | safe }}">read more…</a>
|
||||
{{ post.summary | safe}}
|
||||
<a class="read-more" href="/{{ post.path | safe }}">read more…</a>
|
||||
|
||||
{% set translations = page.translations | filter(attribute="lang", value=lang) %}
|
||||
{% if translations %}
|
||||
<div class="post-translation">
|
||||
{% set post = translations.0 %}
|
||||
<b>Community Translation: <a href="{{ post.permalink }}">{{ post.title }}</a></b>
|
||||
</div>
|
||||
{% if not_translated %}
|
||||
<aside class="no-translation">
|
||||
(This post is not translated yet.)
|
||||
</aside>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user