mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-11-12 05:59:20 +00:00
🐛 Encode article titles and permalinks in sharing links
This commit is contained in:
1 parent
ebe683e9c2
commit
3e921f2585
1 file changed
+3
-1
@@ -1,12 +1,14 @@
|
|||||||
{{ with .Params.sharingLinks | default (.Site.Params.article.sharingLinks | default false) }}
|
{{ with .Params.sharingLinks | default (.Site.Params.article.sharingLinks | default false) }}
|
||||||
{{ $links := hugo.Data.sharing }}
|
{{ $links := hugo.Data.sharing }}
|
||||||
|
{{ $pageURL := urlquery $.Permalink }}
|
||||||
|
{{ $pageTitle := urlquery $.Title }}
|
||||||
<section class="flex flex-row flex-wrap justify-center pt-4 text-xl">
|
<section class="flex flex-row flex-wrap justify-center pt-4 text-xl">
|
||||||
{{ range . }}
|
{{ range . }}
|
||||||
{{ with index $links . }}
|
{{ with index $links . }}
|
||||||
<a
|
<a
|
||||||
class="m-1 rounded bg-neutral-300 p-1.5 text-neutral-700 hover:bg-primary-500 hover:text-neutral dark:bg-neutral-700 dark:text-neutral-300 dark:hover:bg-primary-400 dark:hover:text-neutral-800"
|
class="m-1 rounded bg-neutral-300 p-1.5 text-neutral-700 hover:bg-primary-500 hover:text-neutral dark:bg-neutral-700 dark:text-neutral-300 dark:hover:bg-primary-400 dark:hover:text-neutral-800"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="{{ printf .url $.Permalink $.Title | safeURL }}"
|
href="{{ printf .url (cond (eq .icon "mastodon") (replace $pageURL "+" "%20") $pageURL) (cond (eq .icon "mastodon") (replace $pageTitle "+" "%20") $pageTitle) | safeURL }}"
|
||||||
title="{{ i18n .title }}"
|
title="{{ i18n .title }}"
|
||||||
aria-label="{{ i18n .title }}">
|
aria-label="{{ i18n .title }}">
|
||||||
{{ partial "icon.html" .icon }}
|
{{ partial "icon.html" .icon }}
|
||||||
|
|||||||
Reference in new issue
Block a user