From 83e5b019e4704b4fe7f61627ea3f972a04e289b6 Mon Sep 17 00:00:00 2001 From: Cristian Date: Thu, 16 Jul 2020 12:43:22 -0500 Subject: [PATCH] feat: Add canonical link http header to the static response --- archivebox/core/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archivebox/core/views.py b/archivebox/core/views.py index 5fb43119..ce6e8f58 100644 --- a/archivebox/core/views.py +++ b/archivebox/core/views.py @@ -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