From 77059e3710117edade27219781d9ef7c24b09416 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 8 Jan 2019 08:23:31 -0500 Subject: [PATCH] assign canonical directly if custom value exists (#2021) --- _includes/seo.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_includes/seo.html b/_includes/seo.html index 9367b641..d4a762a1 100644 --- a/_includes/seo.html +++ b/_includes/seo.html @@ -14,7 +14,11 @@ {%- assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once -%} {%- endif -%} -{%- assign canonical_url = page.url | replace: "index.html", "" | absolute_url %} +{% if page.canonical_url %} + {%- assign canonical_url = page.canonical_url %} +{% else %} + {%- assign canonical_url = page.url | replace: "index.html", "" | absolute_url %} +{% endif %} {%- assign seo_description = page.description | default: page.excerpt | default: site.description -%} {%- if seo_description -%}