Add support for listing other languages versions in a post header

This commit is contained in:
天クマ 2026-04-19 11:53:24 -03:00
commit 8a5e11234f
6 changed files with 36 additions and 0 deletions

View file

@ -2,11 +2,22 @@
layout: base.njk
title: Adrian Victor:Blog
---
{% set altLanguages = collections.post | alternateLanguages(postId, langKey) %}
<main>
<article>
<div id="postHeader">
<h1>{{ postTitle }}</h1>
<p>{{ authors or "Adrian Victor" }} - {{ date }}</p>
{% if altLanguages.length > 0 %}
{{ i18n[langKey].availableInOtherLanguages }}:
{% for alt in altLanguages %}
<li class="inlineList">
<a href="{{ alt.url }}" hreflang="{{ alt.lang }}">
{{ i18n[alt.lang].language }}
</a>
</li>
{% endfor %}
{% endif %}
</div>
{{ content | safe }}
</article>