About Canonical URLs

Canonical URLs are used to indicate the preferred version of a webpage when multiple URLs have similar or duplicate content, helping to avoid SEO issues like duplicate content penalties.

Set this in your base.html to make sure that URLs with query parameters are not counted by search engines as separate URLs:

1
2
<link rel="canonical" 
href="{{ request.scheme }}://{{ request.get_host }}{{ request.path }}" />

Tips and Tricks Development Search Engine Optimization Django 5.x Django 4.2 Django 3.2