www

website
git clone ssh://anon@src.dalliard.ch/www
log | files | refs

commit c7c6c434657b391de644277f9d45d461999d0f7d
parent 49a6dd9a546f4efd91d2dedd1e0b9241411bd36e
author: nathanael <nathanael@dalliard.ch>
date:   Tue, 14 Oct 2025 22:32:48 +0000

i18n

diffstat:
Aassets/www.js | 5+++++
Rstatic/www.svg -> assets/www.svg | 0
Mconfig/_default/config.toml | 6++++++
Acontent/_index.de.md | 4++++
Rcontent/_index.md -> content/_index.en.md | 0
Acontent/bitcoin.de.md | 13+++++++++++++
Acontent/bitcoin.en.md | 16++++++++++++++++
Dcontent/bitcoin.md | 13-------------
Acontent/compass.de.md | 18++++++++++++++++++
Acontent/compass.en.md | 17+++++++++++++++++
Dcontent/compass.md | 15---------------
Acontent/ethics.de.md | 13+++++++++++++
Acontent/ethics.en.md | 13+++++++++++++
Dcontent/ethics.md | 11-----------
Alayouts/_partials/footer.html | 16++++++++++++++++
Alayouts/_partials/header.html | 7+++++++
Alayouts/alias.html | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mlayouts/baseof.html | 13++-----------
18 files changed, 187 insertions(+), 50 deletions(-)

diff --git a/assets/www.js b/assets/www.js @@ -0,0 +1,5 @@ +document.querySelectorAll('[data-lang]').forEach(el => { + el.addEventListener('click', function() { + localStorage.setItem('selectedlanguage', this.dataset.lang) + }) +}) diff --git a/static/www.svg b/assets/www.svg diff --git a/config/_default/config.toml b/config/_default/config.toml @@ -1,4 +1,6 @@ baseURL = 'https://dalliard.ch/' +defaultContentLanguage = 'en' +defaultContentLanguageInSubdir = true disableHugoGeneratorInject = true disableKinds = ['taxonomy', 'rss'] @@ -6,3 +8,7 @@ disableKinds = ['taxonomy', 'rss'] [markup.goldmark] [markup.goldmark.renderer] unsafe = true + +[languages] +[languages.en] +[languages.de] diff --git a/content/_index.de.md b/content/_index.de.md @@ -0,0 +1,4 @@ +--- +title: start +--- +[bitcoin](/bitcoin/) [ethik](/de/ethik/) diff --git a/content/_index.md b/content/_index.en.md diff --git a/content/bitcoin.de.md b/content/bitcoin.de.md @@ -0,0 +1,13 @@ +--- +title: bitcoin +aliases: +- b +- btc +--- +das beste geld +- p2p-netzwerk +- proof of work +- blockchain +- begrenzt + +ich organisiere wöchentlich bitcoin-treffen und -wanderungen im oberwallis ([bitcoin wallis](https://bitcoinwallis.ch)) diff --git a/content/bitcoin.en.md b/content/bitcoin.en.md @@ -0,0 +1,16 @@ +--- +title: bitcoin +aliases: +- b +- btc +- /bitcoin +- /b +- /btc +--- +the best money +- p2p-network +- proof of work +- blockchain +- fixed supply + +i organize weekly bitcoin meetups and walks in upper valais ([bitcoin wallis](https://bitcoinwallis.ch)) diff --git a/content/bitcoin.md b/content/bitcoin.md @@ -1,13 +0,0 @@ ---- -title: bitcoin -aliases: -- b -- btc ---- -the best money -- p2p-network -- proof of work -- blockchain -- fixed supply - -i organize weekly bitcoin meetups and walks in upper valais ([bitcoin wallis](https://bitcoinwallis.ch)) diff --git a/content/compass.de.md b/content/compass.de.md @@ -0,0 +1,18 @@ +--- +title: kompass +slug: kompass +aliases: +- k +- /k +- /kompass +--- +vier instinkte + +|| +-|-|- +N|neu|neuheit +O|wir|kollektiv +S|alt|vertrautheit +W|ich|individuell + +sich und andere verstehen diff --git a/content/compass.en.md b/content/compass.en.md @@ -0,0 +1,17 @@ +--- +title: compass +aliases: +- c +- /c +- /compass +--- +four instincts + +|| +-|-|- +N|new|novelty +E|us|collective +S|old|familiar +W|me|individual + +grok self and others diff --git a/content/compass.md b/content/compass.md @@ -1,15 +0,0 @@ ---- -title: compass -aliases: -- c ---- -four instincts - -|| --|-|- -N|new|novelty -E|us|collective -S|old|familiar -W|me|individual - -grok self and others diff --git a/content/ethics.de.md b/content/ethics.de.md @@ -0,0 +1,13 @@ +--- +title: ethik +slug: ethik +aliases: +- e +- /ethik +--- +|| +-|-|- +H|edonismus|wohl maximieren +E|mpathie|empathie-[kompass](/de/kompass/) +A|moralismus|subjektive moral +L|aisser-faire|bitten, statt fordern diff --git a/content/ethics.en.md b/content/ethics.en.md @@ -0,0 +1,13 @@ +--- +title: ethics +aliases: +- e +- /e +- /ethics +--- +|| +-|-|- +H|edonism|maximize pleasure +E|mpathy|empathy-[compass](/compass/) +A|moralism|subjective morality +L|aisser-faire|ask, not demand diff --git a/content/ethics.md b/content/ethics.md @@ -1,11 +0,0 @@ ---- -title: ethics -aliases: -- e ---- -|| --|-|- -H|edonism|maximize pleasure -E|mpathy|empathy-[compass](/compass/) -A|moralism|subjective morality -L|aisser-faire|ask, not demand diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html @@ -0,0 +1,16 @@ +<nav> + <ul> + <li><a href="mailto:nathanael@dalliard.ch">mail</a></li> + <li><a href="/22b0bce1868386a2cc5b63cac61abf796ebd00e2.asc">pgp</a></li> + {{ if .IsTranslated }} + {{ range .Translations }} + <li><a href="{{ .RelPermalink }}" data-lang="{{ .Language.Lang }}">{{ .Language.Lang }}</a></li> + {{ end }} + {{ with resources.Get "www.js" }} + {{ with . | minify | fingerprint }} + <script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" defer></script> + {{ end }} + {{ end }} + {{ end }} + </ul> +</nav> diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html @@ -0,0 +1,7 @@ +{{ with resources.Get "www.svg" }} +{{ with . | minify | fingerprint }} +<a href="{{ site.Home.Permalink }}"> + <svg><use xlink:href="{{ .RelPermalink }}#logo"></use></svg> +</a> +{{ end }} +{{ end }} diff --git a/layouts/alias.html b/layouts/alias.html @@ -0,0 +1,57 @@ +<!doctype html> +<html lang="{{ site.Language.LanguageCode }}"> + <head> + <title>{{ .Permalink }}</title> + <link rel="canonical" href="{{ .Permalink }}"> + <meta charset="utf-8"> + <noscript> + <meta http-equiv="refresh" content="0; url={{ .Permalink }}"> + </noscript> + <script> + ;(function () { + if (window.location.pathname !== '/') { + window.location.replace('{{ .Permalink }}') + return + } + + var getFirstBrowserLanguage = function () { + var nav = window.navigator, + browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'], + i, + language + + if (Array.isArray(nav.languages)) { + for (i = 0; i < nav.languages.length; i++) { + language = nav.languages[i] + if (language && language.length) { + return language + } + } + } + + for (i = 0; i < browserLanguagePropertyKeys.length; i++) { + language = nav[browserLanguagePropertyKeys[i]] + if (language && language.length) { + return language + } + } + return 'en' + } + + const languages = { + 'en': '/en/', + 'de': '/de/' + }; + + const savedLanguage = localStorage.getItem('selectedlanguage'); + if (savedLanguage) { + window.location.replace(languages[savedLanguage]); + } else { + const preferLang = getFirstBrowserLanguage().slice(0, 2); + const url = languages[preferLang] || languages['en']; + window.location.replace(url); + } + })() + </script> + </head> +</html> diff --git a/layouts/baseof.html b/layouts/baseof.html @@ -9,15 +9,6 @@ {{- end -}} {{ end }} <title>{{ block "title" . }}{{ .Title }}{{ end }}</title> -<header> - <a href="/"><svg><use xlink:href="/www.svg#logo"></use></svg></a> -</header> +<header>{{ partial "header.html" . }}</header> <main id="{{ .Title }}">{{ block "main" . }}{{ end }}</main> -<footer> - <nav> - <ul> - <li><a href="mailto:nathanael@dalliard.ch">mail</a></li> - <li><a href="/22b0bce1868386a2cc5b63cac61abf796ebd00e2.asc">pgp</a></li> - </ul> - </nav> -</footer> +<footer>{{ partial "footer.html" . }}</footer>