From 22e2a7cf74fe8bf12312871d58c0e6c28637ab5a Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sun, 14 Aug 2022 20:03:37 +0100 Subject: [PATCH] fix: encoding of quotes in Page Sharer URL Resolves merge conflicts in #2726 Fix #2726 --- .../layouts/partials/components/page_sharer.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/wowchemy/layouts/partials/components/page_sharer.html b/modules/wowchemy/layouts/partials/components/page_sharer.html index c0359491..79f4d7e0 100644 --- a/modules/wowchemy/layouts/partials/components/page_sharer.html +++ b/modules/wowchemy/layouts/partials/components/page_sharer.html @@ -7,8 +7,14 @@ {{ if in (slice "fab" "fas" "far" "fal") $pack }} {{ $pack_prefix = "fa" }} {{ end }} - {{ $link := replace .url "{url}" ($.Permalink | htmlEscape) }} - {{ $link = replace $link "{title}" ($.Title | htmlEscape) }} + {{/* Utilise `urlquery` over `htmlEscape` to encode sharing URL */}} + {{/* See https://github.com/wowchemy/wowchemy-hugo-themes/pull/2726 */}} + {{ $link := replace .url "{url}" ($.Permalink | urlquery) }} + {{ $link = replace $link "{title}" ($.Title | urlquery) }} + {{/* Workaround `urlquery` encoding for mailto as `urlquery` encodes `+` as `%2B` and ` ` (space) as `+` */}} + {{ if eq (urls.Parse $link).Scheme "mailto" }} + {{ $link = replace $link "+" "%20" }} + {{ end }}