feat: support multilingual sites

This commit is contained in:
Cyril MARPAUD
2023-03-14 10:38:08 +01:00
parent dac13b410e
commit 63e21f0fe0
4 changed files with 36 additions and 7 deletions

@ -2,9 +2,14 @@
{% block content -%}
{% set ext = "" -%}
{% if config.default_language != lang -%}
{% set ext = "." ~ lang -%}
{% endif -%}
{% set sections = [] -%}
{% for section in config.extra.sections | default(value=[]) -%}
{% set_global sections = sections | concat(with=get_section(path=section ~ "/_index.md")) -%}
{% set_global sections = sections | concat(with=get_section(path=section ~ "/_index" ~ ext ~ ".md")) -%}
{% endfor -%}
<div id="particles" class="fullflex"></div>
@ -12,14 +17,24 @@
<div id="landing" class="fullflex">
<div id="splash">
<div id="lang">
{%- for lang,tr in config.languages %}
{% if config.default_language != lang -%}
{% set url = config.base_url ~ "/" ~ lang -%}
{% endif -%}
{% if not loop.first %}| {% endif -%}
<a href="{{ url | default(value=config.base_url | safe) }}">{{ tr.translations.flag | default(value=lang) }}</a>
{%- endfor %}
</div>
<h1 id="name">
{{ macro::format_name(name=config.extra.name) }}
</h1>
{% if config.extra.roles -%}
{% if section.extra.roles -%}
<div id="roles">
<p>
{% for role in config.extra.roles -%}
{%- for role in section.extra.roles %}
<span>{{ role }}</span><br>
{% endfor %}
</p>