Repository navigation
Serve the blog in English and German - #24
Merged
Merged
Conversation
English stays at / and /posts/{slug}; German lives under /de/. A post
gets a German version by adding posts/<date>-<slug>.de.md next to it.
Posts without a translation are still listed and shown with the
interface of the requested language, a note saying which language the
post is in, and a canonical link to the original.
The nav gets an EN/DE switcher, pages carry hreflang links, and
make translate-post starts a translation from the original.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: the blog is English only.
After: there is a German version under
/de/with its own interface texts and German dates ("20. Okt. 2026"). An EN/DE switcher in the nav jumps to the same page in the other language. English URLs stay unchanged.A post gets a German version by adding
posts/<date>-<slug>.de.mdnext to the English file (make translate-post POST=<slug> LANG=decopies it to start with). Translations are optional: a post without one is still listed on the other language's front page with a smallEN/DEbadge, and opening it shows the original with a note ("Diesen Beitrag gibt es nur auf Englisch.") and a canonical link to the original URL. German-only posts work the same way in reverse (make new-post TITLE=… LANG=de).How: posts are now loaded into a
Librarykeyed by slug and language, and the routes are registered once per language from the list ini18n.go, which also holds the interface strings. Pages carryhreflangalternates andx-default. The interactive widgets (terminal, Chaos Monkey, load balancing) stay English for now.hello-worldcomes with a German translation as the first example.