Merge pull request #246 from chrisbanes/cb/sharing-links

Allow overwriting of sharing links
This commit is contained in:
Nuno Coração 2022-11-14 20:45:19 +00:00 committed by GitHub
commit d889efa6d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 32 deletions

View file

@ -1,4 +1,5 @@
{ {
"links": {
"email": { "email": {
"icon": "email", "icon": "email",
"title": "sharing.email", "title": "sharing.email",
@ -29,4 +30,5 @@
"title": "sharing.twitter", "title": "sharing.twitter",
"url": "https://twitter.com/intent/tweet/?url=%s&text=%s" "url": "https://twitter.com/intent/tweet/?url=%s&text=%s"
} }
}
} }

View file

@ -1,8 +1,7 @@
{{ with .Params.sharingLinks | default (.Site.Params.article.sharingLinks | default false) }} {{ with .Params.sharingLinks | default (.Site.Params.article.sharingLinks | default false) }}
{{ $links := site.Data.sharing }}
<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 $.Site.Data.sharing.links }}
{{ with index $links . }} {{ with . }}
<a <a
class="m-1 inline-block min-w-[2.4rem] rounded bg-neutral-300 p-1 text-center 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 inline-block min-w-[2.4rem] rounded bg-neutral-300 p-1 text-center 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"
href="{{ printf .url $.Permalink $.Title }}" href="{{ printf .url $.Permalink $.Title }}"