This commit is contained in:
2026-04-22 22:27:10 +02:00
commit 259e4dd330
7 changed files with 116 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import yaml
import os
with open("content.yaml", "r") as f:
content = yaml.safe_load(f)
for page_name, translations in content.items():
template_file = f"template-{page_name}.html"
with open(template_file, "r") as f:
template = f.read()
for lang, page_data in translations.items():
output = template
output = output.replace("{{lang}}", lang)
for key, value in page_data.items():
output = output.replace(f"{{{{{key}}}}}", value)
output_dir = lang
os.makedirs(output_dir, exist_ok=True)
output_file = os.path.join(output_dir, f"{page_name}.html")
with open(output_file, "w") as f:
f.write(output)
print(f"{output_file} generated.")
+9
View File
@@ -0,0 +1,9 @@
index:
en:
page-title: "Personal Website"
introduction-heading: "Hi, I'm Marco"
introduction-subheading: "and this is my website"
de:
page-title: "Persönliche Webseite"
introduction-heading: "Hi, ich bin Marco"
introduction-subheading: "und das ist meine Webseite"
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta name="robots" content="noindex nofollow">
<link rel="stylesheet" href="../styles.css">
<title>Persönliche Webseite</title>
</head>
<body>
<div>
<h1>Hi, ich bin Marco</h1>
<p>und das ist meine Webseite</p>
</div>
<nav>
<a href="/en/index.html">English</a>
<a href="/de/index.html">Deutsch</a>
</nav>
</body>
</html>
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="robots" content="noindex nofollow">
<link rel="stylesheet" href="../styles.css">
<title>Personal Website</title>
</head>
<body>
<div>
<h1>Hi, I'm Marco</h1>
<p>and this is my website</p>
</div>
<nav>
<a href="/en/index.html">English</a>
<a href="/de/index.html">Deutsch</a>
</nav>
</body>
</html>
+9
View File
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex nofollow">
<meta http-equiv="refresh" content="0; url=/en/index.html">
</head>
<body>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
body {
background-color: #222222;
}
h1, h2, h3, h4, h5, p {
color: #DDDDEE
}
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="{{lang}}">
<head>
<meta name="robots" content="noindex nofollow">
<link rel="stylesheet" href="../styles.css">
<title>{{page-title}}</title>
</head>
<body>
<div>
<h1>{{introduction-heading}}</h1>
<p>{{introduction-subheading}}</p>
</div>
<nav>
<a href="/en/index.html">English</a>
<a href="/de/index.html">Deutsch</a>
</nav>
</body>
</html>