summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBotond Hende <contact@wazul.moe>2026-05-01 12:40:06 +0200
committerBotond Hende <contact@wazul.moe>2026-05-01 12:40:06 +0200
commitdb2f67bdd0902048a5d3faa9fe46a71c4aaa4bb3 (patch)
treeaef73c69bf9e5c34e00e6c7329979b3655c6b069
parent64a4603ec2ca7b77e7331955f8c9edb4d5ae6b87 (diff)
root domain content generation wip
-rw-r--r--__main__.py5
-rw-r--r--config.py12
-rw-r--r--main/templates/main.html.j217
-rw-r--r--modules/main_generate.py28
4 files changed, 57 insertions, 5 deletions
diff --git a/__main__.py b/__main__.py
index 0e1dc48..1f28fdf 100644
--- a/__main__.py
+++ b/__main__.py
@@ -3,9 +3,7 @@ import sys
import jinja2
from .config import Config
-from .modules import blog_generate
-from .modules import comic_generate
-from .modules import codenames_generate
+from .modules import main_generate, blog_generate, comic_generate, codenames_generate
def init_jinja_env() -> jinja2.Environment:
@@ -30,6 +28,7 @@ def main(output_root_path: str, local: bool):
"git_url": Config.GIT_ROOT_URL,
})
+ main_generate.generate(jinja_env, os.path.join(output_root_path, "main"), local)
blog_generate.generate(jinja_env, os.path.join(output_root_path, "blog"), local)
comic_generate.generate(jinja_env, os.path.join(output_root_path, "comic"), local)
codenames_generate.generate(jinja_env, os.path.join(output_root_path, "codenames"), local)
diff --git a/config.py b/config.py
index 81fd243..d5ed156 100644
--- a/config.py
+++ b/config.py
@@ -7,15 +7,23 @@ class Config:
ASSETS_IMPORT_PATH = "/assets"
EMAIL = "webmaster@wazul.moe"
ASSETS_IMPORT_PATH_STATIC = "https://static.wazul.moe"
- MAIN_ROOT_URL = "https://wazul.moe"
GIT_ROOT_URL = "https://git.wazul.moe"
RSS_FILE_NAME = "feed.xml"
TIMEZONE = datetime.timezone(datetime.timedelta(hours=2))
+ # MAIN
+ MAIN_ROOT_URL = "https://wazul.moe"
+ MAIN_NAME = "Wazul's website"
+
# BLOG
BLOG_ROOT_URL = "https://blog.wazul.moe"
BLOG_ASSETS_SOURCE_DIR = os.path.join(__DIR, "blog/assets")
- TEMPLATES_SOURCE_DIR = [os.path.join(__DIR, "blog/templates"), os.path.join(__DIR, "comic/templates"), os.path.join(__DIR, "codenames/templates")]
+ TEMPLATES_SOURCE_DIR = [
+ os.path.join(__DIR, "main/templates"),
+ os.path.join(__DIR, "blog/templates"),
+ os.path.join(__DIR, "comic/templates"),
+ os.path.join(__DIR, "codenames/templates"),
+ ]
POST_SOURCE_DIR = os.path.join(__DIR, "blog/posts")
BLOG_HOSTNAME = "yggdrasil"
diff --git a/main/templates/main.html.j2 b/main/templates/main.html.j2
new file mode 100644
index 0000000..d72558f
--- /dev/null
+++ b/main/templates/main.html.j2
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html dir="ltr" lang="en">
+<head>
+ <meta charset="utf-8"/>
+ <title>{{ title }}</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
+ <meta property="og:title" content="{{ title }}" />
+ <meta property="og:type" content="website" />
+ <meta property="og:url" content="{{ url }}" />
+ <link rel="stylesheet" href="{{ site.assets_path_static }}/css/bootstrap-grid.min.css" />
+</head>
+<body>
+<p>Hello world.</p>
+</body>
+<footer>
+</footer>
+</html>
diff --git a/modules/main_generate.py b/modules/main_generate.py
new file mode 100644
index 0000000..7137537
--- /dev/null
+++ b/modules/main_generate.py
@@ -0,0 +1,28 @@
+import os.path
+import shutil
+import jinja2
+
+from ..config import Config
+import os.path
+import shutil
+
+import jinja2
+
+from ..config import Config
+
+
+def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool):
+ if os.path.exists(output_root_path):
+ shutil.rmtree(output_root_path)
+
+ os.mkdir(output_root_path)
+
+ jinja_env.globals.update(main={
+ "main_url": Config.MAIN_ROOT_URL,
+ })
+
+ root_template = jinja_env.get_template("main.html.j2")
+ with open(os.path.join(output_root_path, "index.html"), "w") as f:
+ f.write(root_template.render({"url" : Config.MAIN_ROOT_URL, "title": Config.MAIN_NAME}))
+
+ shutil.copytree(Config.CODENAMES_ASSETS_SOURCE_DIR, output_root_path + Config.ASSETS_IMPORT_PATH) \ No newline at end of file