Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Added social media icons #314

Open
wants to merge 3 commits into
base: social-media-icons
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions post.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{{#post}}
<div class="{{post_class}} gh-canvas">
<article class="prose lg:prose-xl">
<header class="gh-header">
<h1 id="title">
<header class="gh-header text-center">
<h1>
{{title}}
Expand Down Expand Up @@ -47,12 +49,43 @@
src="{{feature_image}}"
alt="{{title}}"
/>

{{/if}}

{{content}}

<span class="float-right">
Share this article
<a href="https://www.facebook.com" class="fab fa-facebook-square fa-2x" id="facebookButton"></a>
<a href="https://www.twitter.com" class="fab fa-twitter-square fa-2x " id="twitterButton"></a>
<a href="https://www.linkedin.com" class="fab fa-linkedin fa-2x " id="linkedinButton"></a>
</span>

</div>
</article>
{{/post}}
<script type="text/javascript">

var facebookButton = document.getElementById("facebookButton");
var twitterButton = document.getElementById("twitterButton");
var linkedinButton = document.getElementById("linkedinButton");
var title = document.getElementById("title").innerText;
var postUrl = encodeURI(document.location.href);
facebookButton.setAttribute(
"href",
`https://www.facebook.com/sharer.php?u=${postUrl}`
);

twitterButton.setAttribute(
"href",
`https://twitter.com/share?text=${title}`
);

linkedinButton.setAttribute(
"href",
`https://www.linkedin.com/shareArticle?url=${postUrl}&title=${title}`
);
</script>
{{!-- implementation of related articles --}}
{{!-- has to be outside post block due to conflict --}}
<hr class="pb-4">
Expand Down