Try support multi langs

This commit is contained in:
林玮 (Jade Lin) 2024-09-15 00:22:06 +08:00
parent 7f630a4e31
commit 360a6f6207
No known key found for this signature in database
GPG key ID: 8F30F127640DE1CC
2 changed files with 16 additions and 0 deletions

View file

@ -1,6 +1,7 @@
{% import "macros/date.html" as date_macros -%}
{% import "macros/head.html" as head_macros -%}
{% import "macros/menu.html" as menu_macros -%}
{% import "macros/language_menu.html" as language_menu_macros -%}
{% import "macros/post.html" as post_macros -%}
{% import "macros/title.html" as title_macros -%}
@ -57,6 +58,9 @@
</div>
</a>
</div>
{%- if page %}
{{ language_menu_macros::menu(page=page) }}
{% endif -%}
</div>
{% block header_menu %}

View file

@ -0,0 +1,12 @@
{% macro menu(page) %}
<ul class="menu menu--desktop menu--language-selector">
<li class="menu__trigger">Language&nbsp;</li>
<li>
<ul class="menu__dropdown">
{%- for item in page.translations %}
<li><a href="{{ item.permalink }}">{{ item.lang }}</a></li>
{% endfor -%}
</ul>
</li>
</ul>
{% endmacro menu %}