From: Mart Lubbers Date: Mon, 9 Oct 2023 05:58:40 +0000 (+0200) Subject: multilang begin X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=a23580c87d0c9815be43d9c0efaff175992afe23;p=martlubbers.net.git multilang begin --- diff --git a/_config.yml b/_config.yml index 4b153be..f530e41 100644 --- a/_config.yml +++ b/_config.yml @@ -1,11 +1,45 @@ -#baseurl: https://martlubbers.net +# Site settings livereload: true + + #version: '2021-01-01' + +default_language: 'en' +fallback_page: home + +timezone: Europe/Amsterdam +encoding: utf-8 + +# Build settings markdown: kramdown + +# Markdown Processors kramdown: - parse_block_html: true + parse_block_html: true + auto_ids: true + footnote_nr: 1 + entity_output: as_char + toc_levels: 2..3 + +# Defaults defaults: - - - scope: - path: "" - values: - layout: "default" +- + scope: + path: '_posts/en' + type: 'posts' + values: + permalink: 'en/:title' + language: en +- + scope: + path: '_posts/nl' + type: 'posts' + values: + permalink: 'nl/:title' + language: nl +- + scope: + path: '_posts/nds' + type: 'posts' + values: + permalink: 'nds/:title' + language: nds diff --git a/_data/snippets.yml b/_data/snippets.yml new file mode 100644 index 0000000..1af7034 --- /dev/null +++ b/_data/snippets.yml @@ -0,0 +1,39 @@ +title: + en: Mart Lubbers' Website + nl: Mart Lubbers' Webpagina + nds: Mart Lubbers zien Webstie + +languages: + en: + value: en + slug: en + nl: + value: nl + slug: nl + nds: + value: nds + slug: nds + +back: + en: Back to top + nl: Terug naar boven + nds: Teruw noar båm + +top: + en: Top + nl: Boven + nds: Båm + +languagename: + en: Languages + nl: Talen + nds: Språken + +currentfunction: + en: Scientific programmer at TOP Software + nl: Wetenschappelijk programmeur bij TOP Software + nds: Wetenschoppelyk programmeur by TOP Software +fingerprint: + en: Fingerprint + nl: Vingerafdruk + nds: Vingerofdruk diff --git a/_includes/footer.html b/_includes/footer.html new file mode 100644 index 0000000..9516ee3 --- /dev/null +++ b/_includes/footer.html @@ -0,0 +1,8 @@ + diff --git a/_includes/head.html b/_includes/head.html new file mode 100755 index 0000000..ed612a0 --- /dev/null +++ b/_includes/head.html @@ -0,0 +1,20 @@ + + + + + + {% if page.title %}{{ page.title | escape }} / {{ site.title | escape }}{% else %}{{ site.title | escape }}{% endif %} + + +{% include localizations.html %} + + + + \ No newline at end of file diff --git a/_includes/header.html b/_includes/header.html new file mode 100644 index 0000000..1d4c8d7 --- /dev/null +++ b/_includes/header.html @@ -0,0 +1,9 @@ +
+{% include title.html %} + + + +
diff --git a/_includes/index_header.html b/_includes/index_header.html new file mode 100644 index 0000000..85ccbe6 --- /dev/null +++ b/_includes/index_header.html @@ -0,0 +1,4 @@ +{% include img.html alt='A photo of Mart Lubbers' img='p' %}
+{{ site.data.snippets.currentfunction[page.language] }}
+mart@martlubbers.net (GPG: AD3FEBE7)
+mart@cs.ru.nl diff --git a/_includes/language-switch.html b/_includes/language-switch.html new file mode 100644 index 0000000..57cbfad --- /dev/null +++ b/_includes/language-switch.html @@ -0,0 +1,53 @@ + {{ site.data.snippets.languagename[page.language] }}: + {%- for language in site.data.snippets.languages %} + {%- if page.layout == 'page' %} + {%- assign navigation_pages = site.pages + | where: 'language_reference', page.language_reference + | where: 'language', language[1].slug %} + {%- if navigation_pages.size == 1 %} + {%- for navigation_page in navigation_pages %} + {%- assign url = site.baseurl | append: navigation_page.url %} + {%- endfor %} + {%- else %} + {%- assign navigation_pages = site.pages + | where: 'language_reference', site.fallback_page + | where: 'language', language[1].slug %} + {%- for navigation_page in navigation_pages %} + {%- assign url = site.baseurl | append: navigation_page.url %} + {%- endfor %} + {%- endif %} + + {%- elsif page.layout == 'post' %} + {%- assign navigation_posts = site.posts + | where: 'language_reference', page.language_reference + | where: 'language', language[1].slug %} + {%- if navigation_posts.size == 1 %} + {%- for navigation_post in navigation_posts %} + {%- assign url = site.baseurl | append: navigation_post.url %} + {%- endfor %} + {%- else %} + {%- assign navigation_pages = site.pages + | where: 'language_reference', site.fallback_page + | where: 'language', language[1].slug %} + {%- for navigation_page in navigation_pages %} + {%- assign url = site.baseurl | append: navigation_page.url %} + {%- endfor %} + {%- endif %} + + {%- else %} + {%- assign navigation_pages = site.pages + | where: 'language_reference', site.fallback_page + | where: 'language', language[1].slug %} + {%- for navigation_page in navigation_pages %} + {%- assign url = site.baseurl | append: navigation_page.url %} + {%- endfor %} + + {%- endif %} + {%- if language[1].slug == page.language %} + + {%- endif %} + {{ language[1].value }} + {%- if language[1].slug == page.language %} + + {%- endif %} + {%- endfor %} diff --git a/_includes/localizations.html b/_includes/localizations.html new file mode 100755 index 0000000..4dd05d5 --- /dev/null +++ b/_includes/localizations.html @@ -0,0 +1,24 @@ +{%- if page.layout == 'page' %} + {%- assign localized_pages = site.pages + | where: 'language_reference', page.language_reference + | sort: 'language' %} + {%- for localized_page in localized_pages %} + + {%- endfor %} + +{%- elsif page.layout == 'post' %} + {%- assign localized_posts = site.posts + | where: 'language_reference', page.language_reference + | sort: 'language' %} + {%- for localized_post in localized_posts %} + + {%- endfor %} + +{%- elsif page.layout == 'index' %} + {%- assign localized_pages = site.pages + | where: 'language_reference', site.fallback_page + | sort: 'language' %} + {%- for localized_page in localized_pages %} + + {%- endfor %} +{%- endif %} \ No newline at end of file diff --git a/_includes/navigation.html b/_includes/navigation.html new file mode 100644 index 0000000..6bb9f3d --- /dev/null +++ b/_includes/navigation.html @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/_includes/posts.html b/_includes/posts.html new file mode 100755 index 0000000..d06794a --- /dev/null +++ b/_includes/posts.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/_includes/title.html b/_includes/title.html new file mode 100644 index 0000000..562c317 --- /dev/null +++ b/_includes/title.html @@ -0,0 +1,13 @@ + {%- if page.language == site.default_language %} + {%- assign url = site.baseurl | append: '/'%} + {%- else %} + {%- assign navigation_pages = site.pages + | where: 'language_reference', site.fallback_page + | where: 'language', page.language %} + {%- for navigation_page in navigation_pages %} + {%- assign url = site.baseurl | append: navigation_page.url %} + {%- endfor %} + {%- endif %} +

+ {{ site.title }} +

\ No newline at end of file diff --git a/_includes/toc.html b/_includes/toc.html new file mode 100644 index 0000000..593a934 --- /dev/null +++ b/_includes/toc.html @@ -0,0 +1,4 @@ +#### Table of Contents + +* - +{:toc} diff --git a/_includes/toc.md b/_includes/toc.md new file mode 100644 index 0000000..593a934 --- /dev/null +++ b/_includes/toc.md @@ -0,0 +1,4 @@ +#### Table of Contents + +* - +{:toc} diff --git a/_layouts/default.html b/_layouts/index.html similarity index 78% rename from _layouts/default.html rename to _layouts/index.html index 0d529fa..c3fab70 100644 --- a/_layouts/default.html +++ b/_layouts/index.html @@ -4,6 +4,7 @@ {{ page.title }} + {% include localizations.html %}
@@ -13,26 +14,31 @@ {% endif %} {{ page.title }} + {% include language-switch.html %} {% if page.collection == "posts" %} Terug naar het blog {% endif %} - {% if page.name != "index.md" %} + {% if page.layout != "index" %} Back to home/terug naar home {% endif %} +
+ {% include index_header.html %} +
{{ content }}