Skip to content

Commit aeb4da4

Browse files
committed
language switcher
1 parent 2c41b39 commit aeb4da4

8 files changed

Lines changed: 65 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ _site
33
.jekyll-cache
44
.jekyll-metadata
55
vendor
6+
bin/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ comment embedding js: https://github.com/dpecos/mastodon-comments/
88
The script I wrote to automatically post on publication, together with setup instructions, can be found here: https://github.com/jon011235/mastodon-comments-autopost
99

1010
TODO:
11+
- translations for everything
1112
- mastodon verification (https://docs.joinmastodon.org/user/profile/#verification)
1213
- banner on every page (header with disclaimer about being civil and favorable when reading as well as asking whether people want updates)
1314
- Mail Newsletter?

_config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mastodon:
2828
instance: troet.cafe
2929

3030
#lang: de-DE
31-
languages: ["en", "de"]
31+
languages: ["de", "en"]
3232
default_lang: "de"
3333
exclude_from_localization: ["javascript", "images", "css", "public", "sitemap", "CNAME"]
3434
parallel_localization: true
@@ -40,6 +40,7 @@ theme: minima
4040
# TODO needed? https://stackoverflow.com/questions/19483975/jekyll-on-github-pages-any-way-to-add-footnotes-in-markdown
4141
plugins:
4242
- jekyll-feed
43+
- jekyll-polyglot
4344

4445
# Exclude from processing.
4546
# The following items will not be processed, by default.

_includes/header.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<header class="site-header" role="banner">
2+
3+
<div class="wrapper">
4+
<style>
5+
/* Minimal language-switcher styles (keeps theme CSS intact) */
6+
.lang-switcher { list-style: none; display: inline-block; margin: 0 0 0 12px; vertical-align: middle; padding: 0; }
7+
.lang-switcher li { display: inline-block; margin-left: 8px; }
8+
.lang-switcher li.active a { font-weight: 700; text-decoration: underline; }
9+
.lang-unavailable { color: #666; opacity: 0.85; cursor: default; text-decoration: none; pointer-events: none; }
10+
11+
/* Yellow centered warning box for translation notice */
12+
.translation-notice {
13+
background: #fff3cd;
14+
color: #856404;
15+
border: 1px solid #ffeeba;
16+
padding: 12px 16px;
17+
border-radius: 6px;
18+
text-align: center;
19+
max-width: 820px;
20+
margin: 14px auto 0 auto;
21+
font-size: 0.95rem;
22+
}
23+
</style>
24+
<a class="site-title" rel="author" href="{{ "/" | relative_url }}">{{ site.title }}</a>
25+
<nav class="site-nav">
26+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
27+
<label for="nav-trigger">
28+
<span class="menu-icon">
29+
<svg viewBox="0 0 18 15" width="18px" height="15px">
30+
<path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"/>
31+
</svg>
32+
</span>
33+
</label>
34+
35+
<div class="trigger"><a class="page-link" href="{{ "/about/" | relative_url }}">About</a></div>
36+
37+
<ul class="lang-switcher">
38+
39+
<!--copied and then modified from: https://github.com/untra/polyglot/blob/main/site/_includes/sidebar.html -->
40+
{% for tongue in site.languages %}
41+
{% assign is_unavailable = false %}
42+
{% if tongue != site.active_lang and page.missing_languages contains tongue %}{% assign is_unavailable = true %}{% endif %}
43+
<a{% if tongue == site.active_lang %} style="font-weight: bold;"{% endif %}{% if is_unavailable %} class="lang-unavailable" title="{{ site.data.sidebar.not_available }}"{% endif %} {% static_href %}href="{% if tongue == site.default_lang %}{{site.baseurl}}{{page.url}}{% else %}{{site.baseurl}}/{{ tongue }}{{page.url}}{% endif %}"{% endstatic_href %} >{{ tongue }}</a>{%- if forloop.last == false -%}{{" "}}{{ site.langsep }}{%- endif -%}
44+
{% endfor %}
45+
46+
</ul>
47+
</nav>
48+
</div>
49+
50+
{% if page.rendered_lang != site.active_lang %}
51+
<div class="translation-notice">
52+
This page is not yet available in {{ site.active_lang }}.
53+
Showing {{ page.rendered_lang }} version.
54+
</div>
55+
{% endif %}
56+
57+
</header>

_posts/2025-12-14-atheismus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2025-12-14 14:24:00 +0100
55
categories: reflection
66
comment_id: '115828460090009764'
77
---
8-
> Dieser Text ist definitiv nichts **Unglaubliches Neues** und ist wahrscheinlich auch schlechter belegt. Ich hoffe, du findest ihn trotzdem interessant.
8+
> Dieser Text ist definitiv nichts **Neues** und ist wahrscheinlich auch schlechter belegt. Ich hoffe, du findest ihn trotzdem interessant.
99
> Als Gegenthese könnte man beispielsweise Richard Dawkins lesen, den ich persönlich als selbst dogmatisch empfinde. Ich möchte außerdem hinzufügen, dass ich zu den meisten hier genannten Dingen bislang keine Primärquelle gelesen habe.
1010
1111
Einige Definitionen zum Zweck dieses Posts:

about.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
layout: page
33
title: About
44
permalink: /about/
5+
lang: de
56
---
67

78
Hallo,

index-de.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
layout: home
66
lang: de
7+
permalink: /
78
---
89

910
## Willkommen!

index.markdown renamed to index-en.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
layout: home
66
lang: en
7+
permalink: /
78
---
89

910
## Welcome!

0 commit comments

Comments
 (0)