Skip to content

Commit

Permalink
Enable visitors to switch corresponding EN/JA page if exist
Browse files Browse the repository at this point in the history
  • Loading branch information
yasulab committed Jan 18, 2025
1 parent 15d479c commit 62587f1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/_layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ <h1 class="post-title" data-aos="fade-up" data-aos-delay="200" data-aos-offset="
</div>

<p>
{{ site.data.translations.link[page.lang] }}: <a href="{{ page.link }}">{{ page.link }}</a>
{{ site.data.translations.link[page.lang] }}: <a href="{{ page.link }}">{{ page.link }}</a><br>
{% assign urls = site.posts | map: 'url' | sort %}
{% assign url_en = page.url | replace_first: page.lang, 'en' %}
{% assign url_ja = page.url | replace_first: page.lang, 'ja' %}
{% if page.lang == 'en' and urls contains url_ja %}
{{ site.data.translations.link[page.lang] }}: <a href='{{ url_ja }}'>&raquo; Switch to Japanese</a>
{% elsif page.lang == 'ja' and urls contains url_en %}
{{ site.data.translations.link[page.lang] }}: <a href='{{ url_en }}'>&raquo; Switch to English</a>
{% endif %}
</p>
<p>
Expand Down

0 comments on commit 62587f1

Please sign in to comment.