From 67dcff31a629dce38eac80d997e76c2881d80148 Mon Sep 17 00:00:00 2001 From: Jiangyuan Li Date: Sat, 23 Nov 2024 15:23:03 -0500 Subject: [PATCH] Updated Nov 23 2024 --- app.py | 2 +- freeze.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 5ee8283..02d9a3f 100644 --- a/app.py +++ b/app.py @@ -24,7 +24,7 @@ def blog(): return render_template("blog.html", posts=posts) -@app.route("/blog/") +@app.route("/blog/.html") def post(post_slug): post_file = f"posts/{post_slug}.html" if os.path.exists(post_file): diff --git a/freeze.py b/freeze.py index fc2ec5b..3210220 100644 --- a/freeze.py +++ b/freeze.py @@ -5,3 +5,9 @@ if __name__ == "__main__": freezer.freeze() + +@freezer.register_generator +def post(): + posts = ["my-first-post", "learning-flask"] + for post_slug in posts: + yield {"post_slug": post_slug + ".html"} \ No newline at end of file