From 17565a6365b083f23a1c2aec163b66b6e8238522 Mon Sep 17 00:00:00 2001
From: saagit <55336016+saagit@users.noreply.github.com>
Date: Tue, 1 Dec 2020 10:39:12 -0800
Subject: [PATCH] Add option to output canonical URL (#240)
* 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 10c5400..9c1f3a2 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 %}