From e8de7726c53c27095526be30dcbe2aef65676803 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 27 Nov 2020 21:58:24 +0200 Subject: [PATCH] fix(#744): Escape special characters in title (#745) --- CHANGELOG.md | 1 + _includes/head.html | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eb2427..26d013f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Fixed bug where using an image as a navbar title did not render in GitHub Project pages that did not have a custom domain - Fixed issue where image thumbnails on the feed page were always forced into a square rather than maintaining a proper image aspect ratio - Added support for Patreon in the social network links in the footer +- Fixed bug where special characters in the title led to broken share tags (#744) ## v5.0.0 (2020-09-15) diff --git a/_includes/head.html b/_includes/head.html index 9d43c46..730e967 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -4,19 +4,19 @@ {% capture title %} {%- if page.share-title -%} - {{ page.share-title }} + {{ page.share-title | strip_html | xml_escape }} {%- elsif page.title -%} - {{ page.title }} + {{ page.title | strip_html | xml_escape }} {%- else -%} - {{ site.title }} + {{ site.title | strip_html | xml_escape }} {%- endif -%} {% endcapture %} {% capture description %} {%- if page.share-description -%} - {{ page.share-description }} + {{ page.share-description | strip_html | xml_escape }} {%- elsif page.subtitle -%} - {{ page.subtitle }} + {{ page.subtitle | strip_html | xml_escape }} {%- else -%} {%- assign excerpt_length = site.excerpt_length | default: 50 -%} {{ page.content | strip_html | xml_escape | truncatewords: excerpt_length | strip }}