diff --git a/main.py b/main.py index 0590463..f00338f 100644 --- a/main.py +++ b/main.py @@ -16,10 +16,12 @@ from helpers.finances import ( get_latest_month, ) + class StaticPageHandler(SimpleHTTPRequestHandler): def __init__(self, *args, **kwargs): super().__init__(*args, directory="build", **kwargs) + # Configure Jinja2 environment env = Environment(loader=FileSystemLoader("templates")) @@ -91,6 +93,8 @@ def generate_static_site(development_mode=False): template_name = template_file.stem context = kwargs.copy() + context["path"] = f"{template_name}.html" if template_name != "index" else "" + if template_name in ["index", "simple"]: context.update({"services": services}) @@ -158,8 +162,12 @@ def generate_static_site(development_mode=False): if __name__ == "__main__": parser = ArgumentParser(description="Generate the private.coffee static site.") parser.add_argument("--dev", action="store_true", help="Enable development mode") - parser.add_argument("--serve", action="store_true", help="Serve the site after building") - parser.add_argument("--port", type=int, default=8000, help="Port to serve the site on") + parser.add_argument( + "--serve", action="store_true", help="Serve the site after building" + ) + parser.add_argument( + "--port", type=int, default=8000, help="Port to serve the site on" + ) args = parser.parse_args() @@ -170,4 +178,4 @@ if __name__ == "__main__": print(f"Serving on http://localhost:{args.port}") thread = Thread(target=server.serve_forever) thread.start() - thread.join() \ No newline at end of file + thread.join() diff --git a/templates/base.html b/templates/base.html index f70e61d..eb5dba9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -44,6 +44,7 @@ name="twitter:image" content="https://private.coffee/assets/img/logo-inv_grad.png" /> +