Skip to content

Commit

Permalink
Updated Nov 23 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiangyuan Li authored and Jiangyuan Li committed Nov 23, 2024
1 parent a502ee3 commit 67dcff3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def blog():
return render_template("blog.html", posts=posts)


@app.route("/blog/<post_slug>")
@app.route("/blog/<post_slug>.html")
def post(post_slug):
post_file = f"posts/{post_slug}.html"
if os.path.exists(post_file):
Expand Down
6 changes: 6 additions & 0 deletions freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

0 comments on commit 67dcff3

Please sign in to comment.