From 3cf9304321f06649dc7bf2bf00aa0574f61fc0d6 Mon Sep 17 00:00:00 2001 From: Tommi Date: Fri, 19 Jul 2024 13:06:10 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=EF=B8=8F=20More=20explanations=20f?= =?UTF-8?q?or=20i18n=20system=20(#7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ournet/_layouts/base.liquid | 10 +++++----- ournet/index.md | 1 + ournet/it/index.md | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ournet/_layouts/base.liquid b/ournet/_layouts/base.liquid index 47d0321..5abb377 100644 --- a/ournet/_layouts/base.liquid +++ b/ournet/_layouts/base.liquid @@ -5,11 +5,11 @@ prefix='og: http://ogp.me/ns#' > - {% if ref %} - {% assign alternates = '' | split: '/' %} - {% for entry in collections.all %} - {% if entry.data.ref == ref and entry.data.lang != lang %} - {% assign alternates = alternates | concat: entry %} + {% if reference_page %}{% comment %}If the page has the reference_page value, it means that it has a translation, or that it is the translation of another page{% endcomment %} + {% assign alternates = '' | split: '/' %}{% comment %}Creating an empty array{% endcomment %} + {% for entry in collections.all %}{% comment %}Loop through all pages of the website{% endcomment %} + {% if entry.data.reference_page == reference_page and entry.data.lang != lang %}{% comment %}Check if the entry has the same reference_page value of the current page, and if it has a different language{% endcomment %} + {% assign alternates = alternates | concat: entry %}{% comment %}If previous conditions apply, add the entry to the array of alternates of this page{% endcomment %} {% endif %} {% endfor %} {% endif %} diff --git a/ournet/index.md b/ournet/index.md index 1aa5080..b18c9b6 100644 --- a/ournet/index.md +++ b/ournet/index.md @@ -1,5 +1,6 @@ --- title: 🪡 Knitting Our Internet 🧶 +reference_page: index ---
diff --git a/ournet/it/index.md b/ournet/it/index.md index ee9f86b..69a6191 100644 --- a/ournet/it/index.md +++ b/ournet/it/index.md @@ -1,5 +1,6 @@ --- title: 🪡 La Nostra Rete 🧶 +reference_page: index ---
Un gruppo di persone sedute in cerchio, connesse da un filo rosso