1
0
Fork 0
mirror of synced 2024-06-02 10:34:43 +12:00

Merge pull request #366 from cdvv7788/hotfix/#92

feat: Add canonical link http header to the static response
This commit is contained in:
Nick Sweeting 2020-07-16 14:34:50 -04:00 committed by GitHub
commit 8ea958bb72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,7 +107,9 @@ class LinkDetails(View):
# slug is a timestamp
by_ts = {page.timestamp: page for page in all_pages}
try:
return static.serve(request, archivefile, by_ts[slug].link_dir, show_indexes=True)
response = static.serve(request, archivefile, by_ts[slug].link_dir, show_indexes=True)
response["Link"] = f'<{by_ts[slug].url}>; rel="canonical"'
return response
except KeyError:
pass