From 9fd42720fd0e26375e196fed25f5ea9c14d48ee4 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 16 Aug 2021 17:06:35 +1000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20social=20sharing=20links?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/_default/params.toml | 1 + data/sharing.json | 27 +++++++++++++++++++++++++++ layouts/_default/single.html | 3 ++- layouts/partials/author.html | 2 +- layouts/partials/sharing-links.html | 15 +++++++++++++++ static/css/main.css | 2 +- 6 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 data/sharing.json create mode 100644 layouts/partials/sharing-links.html diff --git a/config/_default/params.toml b/config/_default/params.toml index 2c290954..99730681 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -17,6 +17,7 @@ showHeadingAnchors = true showPagination = true showReadingTime = true + # sharingLinks = ["facebook", "twitter", "reddit", "linkedin", "email"] [list] groupByYear = true diff --git a/data/sharing.json b/data/sharing.json new file mode 100644 index 00000000..327c9b1d --- /dev/null +++ b/data/sharing.json @@ -0,0 +1,27 @@ +{ + "email": { + "icon": "email", + "title": "Send via email", + "url": "mailto:?body=%s&subject=%s" + }, + "facebook": { + "icon": "facebook", + "title": "Share on Facebook", + "url": "https://www.facebook.com/sharer/sharer.php?u=%s"e=%s" + }, + "linkedin": { + "icon": "linkedin", + "title": "Share on LinkedIn", + "url": "https://www.linkedin.com/shareArticle?mini=true&url=%s&title=%s" + }, + "reddit": { + "icon": "reddit", + "title": "Submit to Reddit", + "url": "https://reddit.com/submit/?url=%s&resubmit=true&title=%s" + }, + "twitter": { + "icon": "twitter", + "title": "Tweet on Twitter", + "url": "https://twitter.com/intent/tweet/?url=%s&text=%s" + } +} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a77d1420..2d7653c8 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -16,8 +16,9 @@
{{ .Content | emojify }}
-