diff options
| author | Botond Hende <contact@wazul.moe> | 2026-05-08 17:43:38 +0200 |
|---|---|---|
| committer | Botond Hende <contact@wazul.moe> | 2026-05-08 17:43:38 +0200 |
| commit | 64c955727529d9dd4275c9508008c5808014afc4 (patch) | |
| tree | 4bd4a7fca59f29d55f187e90349cae43c7652811 /modules/main_generate.py | |
| parent | 6acf1f0695d3da227181708e9b98e970f2649bf5 (diff) | |
multiple sites on root domain
Diffstat (limited to 'modules/main_generate.py')
| -rw-r--r-- | modules/main_generate.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/main_generate.py b/modules/main_generate.py index 550c77c..5e058ed 100644 --- a/modules/main_generate.py +++ b/modules/main_generate.py @@ -23,8 +23,11 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): os.mkdir(output_root_path) - root_template = jinja_env.get_template("main_base.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})) + for page in ("index", "neighbors"): + template = jinja_env.get_template(f"main_{page}.html.j2") + html_file_name = f"{page}.html" + with open(os.path.join(output_root_path, html_file_name), "w") as f: + url = (Config.MAIN_ROOT_URL + ("" if page == "index" else "/" + html_file_name)) + f.write(template.render({"url" : url})) shutil.copytree(Config.MAIN_ASSETS_SOURCE_DIR, output_root_path + Config.ASSETS_IMPORT_PATH)
\ No newline at end of file |
