From 2e7e343ce2433b676da41616cdd9c93a05da9b8f Mon Sep 17 00:00:00 2001
From: mountainbug95 <tannersmithtn95@gmail.com>
Date: Wed, 05 Feb 2020 16:25:46 +0000
Subject: [PATCH] Add social media share buttons to the post layout
---
layouts/_default/single.html | 4 +
exampleSite/content/post/chapter-6.md | 6 +++
exampleSite/content/post/chapter-5.md | 6 +++
exampleSite/content/post/chapter-4.md | 6 +++
exampleSite/content/post/chapter-1.md | 6 +++
exampleSite/content/post/chapter-2.md | 6 +++
exampleSite/content/post/chapter-3.md | 6 +++
layouts/partials/social-share.html | 28 ++++++++++++++
8 files changed, 67 insertions(+), 1 deletions(-)
diff --git a/exampleSite/content/post/chapter-1.md b/exampleSite/content/post/chapter-1.md
index ff2a14f..bbeaee6 100644
--- a/exampleSite/content/post/chapter-1.md
+++ b/exampleSite/content/post/chapter-1.md
@@ -4,6 +4,12 @@
featured_image: "/images/Pope-Edouard-de-Beaumont-1844.jpg"
tags: ["scene"]
title: "Chapter I: The Grand Hall"
+social_share:
+ display_social_share: true
+ social_items:
+ facebook: true
+ twitter: true
+ linkedin: true
---
Three hundred and forty-eight years, six months, and nineteen days ago
diff --git a/exampleSite/content/post/chapter-2.md b/exampleSite/content/post/chapter-2.md
index b3c7d4f..02adad5 100644
--- a/exampleSite/content/post/chapter-2.md
+++ b/exampleSite/content/post/chapter-2.md
@@ -4,6 +4,12 @@
featured_image: ""
tags: []
title: "Chapter II: Pierre Gringoire"
+social_share:
+ display_social_share: true
+ social_items:
+ facebook: true
+ twitter: true
+ linkedin: true
---
Nevertheless, as be harangued them, the satisfaction and admiration
diff --git a/exampleSite/content/post/chapter-3.md b/exampleSite/content/post/chapter-3.md
index cd29cee..07c55b3 100644
--- a/exampleSite/content/post/chapter-3.md
+++ b/exampleSite/content/post/chapter-3.md
@@ -4,6 +4,12 @@
featured_image: ""
tags: []
title: "Chapter III: Monsieur the Cardinal"
+social_share:
+ display_social_share: true
+ social_items:
+ facebook: true
+ twitter: true
+ linkedin: true
---
Poor Gringoire! the din of all the great double petards of the Saint-Jean,
diff --git a/exampleSite/content/post/chapter-4.md b/exampleSite/content/post/chapter-4.md
index f49d937..903d317 100644
--- a/exampleSite/content/post/chapter-4.md
+++ b/exampleSite/content/post/chapter-4.md
@@ -4,6 +4,12 @@
featured_image: ""
tags: ["scene"]
title: "Chapter IV: Master Jacques Coppenole"
+social_share:
+ display_social_share: true
+ social_items:
+ facebook: true
+ twitter: true
+ linkedin: true
---
While the pensioner of Ghent and his eminence were exchanging very low
bows and a few words in voices still lower, a man of lofty stature, with a
diff --git a/exampleSite/content/post/chapter-5.md b/exampleSite/content/post/chapter-5.md
index e0f5d28..0e2d72d 100644
--- a/exampleSite/content/post/chapter-5.md
+++ b/exampleSite/content/post/chapter-5.md
@@ -4,6 +4,12 @@
featured_image: ""
tags: []
title: "Chapter V: Quasimodo"
+social_share:
+ display_social_share: true
+ social_items:
+ facebook: true
+ twitter: true
+ linkedin: true
---
In the twinkling of an eye, all was ready to execute Coppenole’s idea. Bourgeois, scholars and law clerks all set to work. The little chapel situated opposite the marble table was selected for the scene of the grinning match. A pane broken in the pretty rose window above the door, left free a circle of stone through which it was agreed that the competitors should thrust their heads. In order to reach it, it was only necessary to mount upon a couple of hogsheads, which had been produced from I know not where, and perched one upon the other, after a fashion. It was settled that each candidate, man or woman (for it was possible to choose a female pope), should, for the sake of leaving the impression of his grimace fresh and complete, cover his face and remain concealed in the chapel until the moment of his appearance. In less than an instant, the chapel was crowded with competitors, upon whom the door was then closed.
diff --git a/exampleSite/content/post/chapter-6.md b/exampleSite/content/post/chapter-6.md
index c767196..c6cb131 100644
--- a/exampleSite/content/post/chapter-6.md
+++ b/exampleSite/content/post/chapter-6.md
@@ -4,6 +4,12 @@
featured_image: "/images/esmeralda.jpg"
tags: []
title: "Chapter VI: Esmeralda"
+social_share:
+ display_social_share: true
+ social_items:
+ facebook: true
+ twitter: true
+ linkedin: true
---
We are delighted to be able to inform the reader, that during the whole of
this scene, Gringoire and his piece had stood firm. His actors, spurred on
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 648a45e..a940308 100755
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -14,7 +14,8 @@
*/}}
{{with .CurrentSection.Title }}{{. | upper }}{{end}}
</aside>
- <h1 class="f1 athelas mb1">
+ {{ partial "social-share.html" . }}
+ <h1 class="f1 athelas mt3 mb1">
{{- .Title -}}
</h1>
{{ with .Params.author }}
@@ -32,6 +33,7 @@
<time class="f6 mv4 dib tracked" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Date.Format "January 2, 2006" -}}
</time>
+
{{/*
Show "reading time" and "word count" but only if one of the following are true:
1) A global config `params` value is set `show_reading_time = true`
diff --git a/layouts/partials/social-share.html b/layouts/partials/social-share.html
new file mode 100644
index 0000000..7437f07
--- /dev/null
+++ b/layouts/partials/social-share.html
@@ -0,0 +1,28 @@
+{{ $site := .Site }}
+{{ $title := .Title }}
+{{ $url := printf "%s" .URL | absLangURL }}
+{{ $body := print $title ", by " .Site.Title "\n" .Params.description "\n\n" $url "\n" }}
+{{ $icon_size := "32px" }}
+{{ $test_url := printf "%s" "https://www.google.com/" }}
+{{ if .Params.social_share.display_social_share }}
+ {{ $social := .Params.social_share.social_items }}
+ <div id="sharing" class="mt3">
+ {{ with $social.facebook }}
+ <a href="http://www.facebook.com/sharer.php?u={{ $url }}" class="facebook no-underline" aria-label="share on Facebook">
+ {{ partialCached "svg/facebook.svg" (dict "size" $icon_size) $icon_size }}
+ </a>
+ {{ end }}
+
+ {{ with $social.twitter }}
+ <a href="http://twitter.com/share?url={{ $url }}&text={{ $title }}&via={{with $site.Social.twitter }}{{ . }}{{ end }}" class="twitter no-underline" aria-label="share on Twitter">
+ {{ partialCached "svg/twitter.svg" (dict "size" $icon_size) $icon_size }}
+ </a>
+ {{ end }}
+
+ {{ with $social.linkedin }}
+ <a href="http://www.linkedin.com/shareArticle?mini=true&url={{ $url }}&title={{ $title }}" class="linkedin no-underline" aria-label="share on LinkedIn">
+ {{ partialCached "svg/linkedin.svg" (dict "size" $icon_size) $icon_size }}
+ </a>
+ {{ end }}
+ </div>
+{{ end }}
\ No newline at end of file
--
Gitblit v1.10.0