From 7c7082fbc6bbaeb48aded3e2a598130a1c0b343f Mon Sep 17 00:00:00 2001 From: jwansek Date: Tue, 21 Mar 2023 14:11:05 +0000 Subject: Added redirecting blog posts --- app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app.py') diff --git a/app.py b/app.py index 75558f8..7847914 100755 --- a/app.py +++ b/app.py @@ -113,11 +113,15 @@ def get_thought(): thought_id = flask.request.args.get("id", type=int) with database.Database() as db: try: - category_name, title, dt, parsed, headers = parser.get_thought_from_id(db, thought_id) + category_name, title, dt, parsed, headers, redirect = parser.get_thought_from_id(db, thought_id) # print(headers) except TypeError: flask.abort(404) return + + if redirect is not None: + return flask.redirect(redirect, code = 301) + return flask.render_template( "thought.html.j2", **get_template_items(title, db), -- cgit v1.2.3