How to provide canonical URL with Django HttpResponseRedirect?
I think this is the correct built template tag that you're looking for. {{ request.build_absolute_uri }}
You can just put it as part of the HTML returned from the Django template, in the <head>
section.
Do you have a base.html
in your Django? You can setup a {% block %}
as a placeholder for the canonical URL and then set that value in each individual page that {% extends base.html %}
base.html
<html>
<head>
<link rel="canonical" href="{% block canonical_url %}{% endblock %}">
</head>
...