From 4448b13580a28a63f964679ba87578003e8212ca Mon Sep 17 00:00:00 2001 From: samuel-p Date: Mon, 5 Apr 2021 21:46:34 +0200 Subject: [PATCH] minor bug fix in translation urls added more heading icons --- .eleventy.js | 3 +++ src/_includes/layouts/base.njk | 17 +++-------------- src/de/contact.html | 2 +- src/de/imprint.html | 2 +- src/de/privacy.html | 2 +- src/en/contact.html | 2 +- src/en/imprint.html | 2 +- src/en/privacy.html | 6 ++---- 8 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 9a02e4b..df43924 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -11,6 +11,9 @@ module.exports = function(eleventyConfig) { "node_modules/@fortawesome/fontawesome-free/webfonts/": "font", "node_modules/flag-icon-css/flags/4x3/(de|us)*": "flags" }); + eleventyConfig.addShortcode("translatedUrl", function(currentLocale, newLocale) { + return this.page.url.replace(new RegExp(`\/${currentLocale}\/`), `/${newLocale}/`); + }); return { dir: { diff --git a/src/_includes/layouts/base.njk b/src/_includes/layouts/base.njk index 31b61d6..98618b1 100644 --- a/src/_includes/layouts/base.njk +++ b/src/_includes/layouts/base.njk @@ -43,14 +43,8 @@ title: sp-codes
{% for language in site.languages %} - {% set translatedUrl = "/" + language.code + "/" %} - {% for item in collections.all %} - {% if item.data.key == key and item.data.locale == language.code and not item.data.hidden %} - {% set translatedUrl = item.url %} - {% endif %} - {% endfor%}
- +
@@ -74,20 +68,15 @@ title: sp-codes
{% for language in site.languages %} - {% set translatedUrl = "/" + language.code + "/" %} - {% for item in collections.all %} - {% if item.data.key == key and item.data.locale == language.code and not item.data.hidden %} - {% set translatedUrl = item.url %} - {% endif %} - {% endfor%} {% endfor %}
+

{{url}}

{{ content | safe }} diff --git a/src/de/contact.html b/src/de/contact.html index b79223a..2d31e59 100644 --- a/src/de/contact.html +++ b/src/de/contact.html @@ -8,7 +8,7 @@ eleventyNavigation: icon: comment-dots order: 3 --- -

Kontaktmöglichkeiten

+

Kontaktmöglichkeiten

Du möchtest mit mir in Kontakt treten, mir einen Fehler mitteilen, hast eine Frage zu einem Dienst oder möchtest mich unterstützen? Schick mir gerne deine Nachricht auf einem der folgenden Wege. Ich freue mich von dir zu hören.

diff --git a/src/de/imprint.html b/src/de/imprint.html index 647cea9..a2fc900 100644 --- a/src/de/imprint.html +++ b/src/de/imprint.html @@ -2,7 +2,7 @@ layout: base.njk title: Impressum --- -

Impressum

+

Impressum

Angaben gemäß § 5 TMG:

Samuel Philipp
diff --git a/src/de/privacy.html b/src/de/privacy.html index 336d9c7..008d443 100644 --- a/src/de/privacy.html +++ b/src/de/privacy.html @@ -2,7 +2,7 @@ layout: base.njk title: Datenschutzerklärung --- -

Datenschutzerklärung

+

Datenschutzerklärung

Verantwortlicher

diff --git a/src/en/contact.html b/src/en/contact.html index dd16f0b..22a4f6c 100644 --- a/src/en/contact.html +++ b/src/en/contact.html @@ -8,7 +8,7 @@ eleventyNavigation: icon: comment-dots order: 3 --- -

Contact Information

+

Contact Information

You want to contact me, report a problem, have a question about a service or would like to support me? Please send me your message in any of the following ways. I am looking forward to receive your message.

diff --git a/src/en/imprint.html b/src/en/imprint.html index 9b4d755..3e0e9e5 100644 --- a/src/en/imprint.html +++ b/src/en/imprint.html @@ -2,7 +2,7 @@ layout: base.njk title: sp-codes --- -

Imprint

+

Imprint

Information as per § 5 TMG:

Samuel Philipp
diff --git a/src/en/privacy.html b/src/en/privacy.html index 439cb13..d540d21 100644 --- a/src/en/privacy.html +++ b/src/en/privacy.html @@ -1,8 +1,6 @@ --- layout: base.njk -title: sp-codes +title: Privacy --- - -

Privacy

+

Privacy

Sorry, this document is only available in German so far. Read it here.

-