Compare commits

...

3 commits

Author SHA1 Message Date
Lyn Fugmann c8e5dfa8f0 copy german start page to root url 2024-09-14 12:44:27 +02:00
Lyn Fugmann 9011b604d2 add basic language switcher 2024-09-14 11:32:32 +02:00
Lyn Fugmann 61415ce5a7 setup i18n 2024-09-14 10:59:22 +02:00
23 changed files with 92 additions and 5 deletions

View file

@ -1,8 +1,15 @@
<footer> <footer>
<div> <div>
<div>[language switcher]</div> {% set otherLang = page.url | locale_links | first %}
<a href="{{otherLang.url}}" lang="{{otherLang.lang}}" hreflang="{{otherLang.lang}}">
{% if otherLang.lang == "de" %}
Deutsche Version 🇩🇪
{% else %}
English Version 🇬🇧/🇺🇸
{% endif %}
</a>
<nav> <nav>
{{ collections.footerNav | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ collections.footerNav | pageLang | eleventyNavigation | eleventyNavigationToHtml | safe }}
</nav> </nav>
</div> </div>
<div> <div>

View file

@ -1,6 +1,6 @@
<header> <header>
<a href="/" title="home">ESE Logo</a> <a href="{{ "/" | locale_url }}" title="home">ESE Logo</a>
<nav> <nav>
{{ collections.mainNav | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ collections.mainNav | pageLang | eleventyNavigation | eleventyNavigationToHtml | safe }}
</nav> </nav>
</header> </header>

View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Barrierefreiheit
tags: footerNav
---
# Barrierefreiheit

7
content/de/campus.md Normal file
View file

@ -0,0 +1,7 @@
---
layout: page.njk
title: Campus & Fakultät
tags: mainNav
---
# Campus & Fakultät

3
content/de/de.json Normal file
View file

@ -0,0 +1,3 @@
{
"lang": "de"
}

6
content/de/faq.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: FAQ
tags: mainNav
---
# Häufig gestellte Fragen

View file

@ -0,0 +1,7 @@
---
layout: page.njk
title: Erste Schritte
tags: mainNav
---
# Erste Schritte

6
content/de/guidelines.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Community-Leitlinien
tags: footerNav
---
# Community-Leitlinien

6
content/de/imprint.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Impressum
tags: footerNav
---
# Impressum

4
content/de/index.md Normal file
View file

@ -0,0 +1,4 @@
---
layout: page.njk
---
# Hallo Welt :)

6
content/de/privacy.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Datenschutz
tags: footerNav
---
# Datenschutz

6
content/de/program.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Programm
tags: mainNav
---
# Programm

3
content/en/en.json Normal file
View file

@ -0,0 +1,3 @@
{
"lang": "en"
}

View file

@ -1,5 +1,6 @@
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy"); const { EleventyHtmlBasePlugin, EleventyI18nPlugin } = require("@11ty/eleventy");
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const fs = require('fs');
// update this :) // update this :)
const year = 2024; const year = 2024;
@ -7,9 +8,28 @@ const year = 2024;
module.exports = function(eleventyConfig) { module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin); eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(eleventyNavigationPlugin); eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addPlugin(EleventyI18nPlugin, {
defaultLanguage: "de",
});
eleventyConfig.addGlobalData("year", year); eleventyConfig.addGlobalData("year", year);
eleventyConfig.addFilter("pageLang", function(value) {
return value.filter(item => item.page.lang === this.page.lang)
});
// copy german start page to root url
eleventyConfig.on(
"eleventy.after",
async ({ dir, runMode, outputMode }) => {
if (outputMode === "fs") {
fs.copyFile(`${dir.output}/de/index.html`, `${dir.output}/index.html`, (err) => {
if (err) console.log(err);
});
}
}
);
return { return {
dir: { dir: {
input: "content", input: "content",