From dfb183b7c57a657979f2e2cba1fbc0cb12396420 Mon Sep 17 00:00:00 2001 From: m0wer Date: Thu, 9 May 2024 11:01:01 +0200 Subject: [PATCH] feat: add index page Closes #1. --- app/modules/site_renderer.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/modules/site_renderer.py b/app/modules/site_renderer.py index 2e8557c..c1140bb 100644 --- a/app/modules/site_renderer.py +++ b/app/modules/site_renderer.py @@ -37,6 +37,25 @@ def render_site(self, site: dict) -> None: with open(site_path / "index.html", "w") as f: f.write(rendered) + def create_index_page(self, conf) -> None: + index_html = f""" + + Idea projects + + +

All projects

+ + + """ + + with open(self.static_pages_dir / "index.html", "w") as f: + f.write(index_html) + def render_sites(self) -> None: with open(self.conf_path, "r") as conf_file: conf = yaml.safe_load(conf_file) @@ -44,6 +63,8 @@ def render_sites(self) -> None: for site in conf["sites"]: self.render_site(site) + self.create_index_page(conf) + if __name__ == "__main__": SiteRenderer(CONF_PATH, TEMPLATE_SRC, STATIC_PAGES_DIR).render_sites()