From 0e88f3ee9ff32812dd022d6e83123ecccdc8c37e Mon Sep 17 00:00:00 2001
From: saagit <55336016+saagit@users.noreply.github.com>
Date: Sun, 16 Aug 2020 08:37:49 -0700
Subject: [PATCH] Add option to output canonical URL
Canonical links are handy to tell search engines which page is
canonical amongst various permutations of URLs (e.g. https vs. http
and www subdomain or not). Add an option to output one via the
following pelicanconf.py setting:
REL_CANONICAL = True
---
templates/base.html | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/templates/base.html b/templates/base.html
index a43e612..9cef799 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -115,6 +115,19 @@
{% endif %}
+ {% if REL_CANONICAL %}
+ {% if page %}
+
+ {% elif article %}
+
+ {% elif page_name == 'index' and not articles_previous_page %}
+
+ {% elif author or category or tag or page_name == 'index' %}
+
+ {% else %}
+
+ {% endif %}
+ {% endif %}
{% block meta %}