fix: encoding of quotes in Page Sharer URL

Resolves merge conflicts in #2726

Fix #2726
This commit is contained in:
George Cushen committed 2022-08-14 20:03:40 +01:00
1 parent 9eb2f1fc3f
commit 22e2a7cf74
1 file changed
+8 -2
@@ -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 }}
<li>
<a href="{{$link|safeURL}}" target="_blank" rel="noopener" class="share-btn-{{.id}}" aria-label="{{.icon}}">
<i class="{{$pack}} {{$pack_prefix}}-{{.icon}}"></i>