Skip to content

Commit

Permalink
Merge pull request canonical#13381 from caldav/blog-redirects-with-utms
Browse files Browse the repository at this point in the history
Pass along UTMs when doing a blog redirect
  • Loading branch information
akbarkz authored Dec 6, 2023
2 parents b72e240 + c590280 commit 143e5ea
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions webapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,10 +736,15 @@ def dispatch_request(self, slug):
if "article" not in context:
return flask.abort(404)

# Redirect canonical annoucements
# Redirect canonical announcements
group = context["article"].get("group")
if isinstance(group, dict) and group["id"] == 2100:
return flask.redirect(f"https://canonical.com/blog/{slug}")
redirect_url = f"https://canonical.com/blog/{slug}"
# Append the original query string to the redirect URL
original_query_string = flask.request.query_string.decode("utf-8")
if original_query_string:
redirect_url += f"?{original_query_string}"
return flask.redirect(redirect_url)

# Set blog notice date
blog_notice = {}
Expand Down

0 comments on commit 143e5ea

Please sign in to comment.