Skip to content

Commit

Permalink
Added social share links to posts
Browse files Browse the repository at this point in the history
  • Loading branch information
nabaco committed May 5, 2020
1 parent e3a27ab commit 4b53075
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
4 changes: 4 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

<link rel="stylesheet" href="{{ "/assets/css/main.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/css/font-awesome.min.css" | relative_url }}">
{% if page.sectionid == "News" %}
<link rel="stylesheet" href="{{ "/assets/css/share.css" | relative_url }}">
{% endif %}


<!-- <link rel="shortcut icon" href="{{ "/favicon.ico?1" | relative_url }}"> -->
<link rel="shortcut icon" href="{{ "/favicon.png?1" | relative_url }}">
Expand Down
22 changes: 22 additions & 0 deletions _includes/share.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

<div class="share-box">
<h5>Share this:</h5>

<a class="f" href="https://www.facebook.com/sharer/sharer.php?u={{site.url}}{{page.url|absolte_path}}" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" ><i class="fa fa-facebook-official fa"></i><span> facebook</span></a>

<a class="t" href="https://twitter.com/intent/tweet?text=&url={{site.url}}{{page.url|absolute_path}}" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><i class="fa fa-twitter fa"></i><span> twitter</span></a>

<a class="g" href="https://plus.google.com/share?url={{site.url}}{{page.url|absolute_path}}" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" ><i class="fa fa-google-plus fa"></i><span> google</span></a>

<a class="r" href="http://www.reddit.com/submit?url={{post.ur|absolute_path}}" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=900,height=500,toolbar=1,resizable=0'); return false;" ><i class="fa fa-reddit fa"></i><span> reddit</span></a>

<a class="l" href="https://www.linkedin.com/shareArticle?mini=true&url={{site.url}}{{page.url|absolute_path}}&title={{page.title}}&summary={{page.excerpt}}&source={{site.title}}" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" ><i class="fa fa-linkedin fa"></i><span> linkedin</span></a>

<a class="e" href="mailto:?subject=&amp;body=Check out this site {{site.url}}{{page.url|absolute_path}}"><i class="fa fa-envelope fa"></i><span> email</span></a>
</div>
2 changes: 1 addition & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ <h1>{{ page.title }}</h1>
<p class="post-meta">{{ page.date | date: "%b %-d, %Y" }}{% if page.author %} • {{ page.author }}{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
<div id="markdown-content-container" class="post-content">{{ content }}</div>
<hr>
{% include share.html %}
<ul class="pager">
{% if page.previous %}
<li class="previous">
Expand All @@ -29,6 +30,5 @@ <h1>{{ page.title }}</h1>
{% endif %}
</ul>
</div>

</div>
</div>
49 changes: 49 additions & 0 deletions assets/css/share.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.share-box a {
display: inline-block;
-webkit-box-shadow: 0 0 1px #777;
box-shadow: 0 0 1px #777;
padding: 5px 12px;
margin-right: 5px;
margin-bottom: 5px;
text-decoration: none; }
.share-box a:hover {
text-decoration: none;
-webkit-transition: background-color 200ms linear;
-ms-transition: background-color 200ms linear;
transition: background-color 200ms linear; }

.f {
color: #3b5998; }
.f:hover {
color: #fff;
background-color: #3b5998; }

.t {
color: #4099FF; }
.t:hover {
color: #fff;
background-color: #4099FF; }

.g {
color: #d34836; }
.g:hover {
color: #fff;
background-color: #d34836; }

.r {
color: #ff5700; }
.r:hover {
color: #fff;
background-color: #ff5700; }

.l {
color: #0077b5; }
.l:hover {
color: #fff;
background-color: #0077b5; }

.e {
color: #444444; }
.e:hover {
color: #fff;
background-color: #444444; }

0 comments on commit 4b53075

Please sign in to comment.