Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 48cf013

Browse files
committed
some modifications to social media sharing section
1 parent 587cb46 commit 48cf013

File tree

4 files changed

+43
-27
lines changed

4 files changed

+43
-27
lines changed

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ defaults:
101101
values:
102102
layout: "post"
103103
comments: true # add comments to all blog posts
104+
social-share: true # add social media sharing buttons to all blog posts
104105
-
105106
scope:
106107
path: "" # all files

_includes/social-share.html

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
1-
<section>
1+
<!-- Check if any share-links are active -->
2+
{% assign any-share-links = false %}
3+
{% for links in site.share-links-active %}
4+
{% if links[1] == true %}
5+
{% assign any-share-links = true %}
6+
{% endif %}
7+
{% endfor %}
8+
9+
{% if any-share-links %}
10+
<section id = "social-share-section">
211

312
<!--- Share on Twitter -->
413
{% if site.share-links-active.twitter %}
5-
<a href="https://twitter.com/intent/tweet?text={{ site.url }}{{ page.url }}" class="btn btn-social btn-sm btn-twitter" title="{{ site.data.ui-text[site.locale].share_on_label }} Twitter">
6-
<i class="fa fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span>
14+
<a href="https://twitter.com/intent/tweet?text={{ site.url }}{{ page.url }}"
15+
class="btn btn-social-icon btn-twitter" title="Share on Twitter">
16+
<span class="fa fa-fw fa-twitter" aria-hidden="true"></span>
717
</a>
818
{% endif %}
919

1020
<!--- Share on Facebook -->
1121
{% if site.share-links-active.facebook %}
12-
<a href="https://www.facebook.com/sharer/sharer.php?u={{ site.url }}{{ page.url }}" class="btn btn-social btn-sm btn-facebook" title="{{ site.data.ui-text[site.locale].share_on_label }} Facebook">
13-
<i class="fa fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span>
22+
<a href="https://www.facebook.com/sharer/sharer.php?u={{ site.url }}{{ page.url }}"
23+
class="btn btn-social-icon btn-facebook" title="Share on Facebook">
24+
<span class="fa fa-fw fa-facebook" aria-hidden="true"></span>
1425
</a>
1526
{% endif %}
1627

1728
<!--- Share on Google Plus -->
1829
{% if site.share-links-active.google %}
19-
<a href="https://plus.google.com/share?url={{ site.url }}{{ page.url }}" class="btn btn-social btn-sm btn-google" title="{{ site.data.ui-text[site.locale].share_on_label }} Google Plus">
20-
<i class="fa fa-fw fa-google-plus" aria-hidden="true"></i><span> Google+</span>
30+
<a href="https://plus.google.com/share?url={{ site.url }}{{ page.url }}"
31+
class="btn btn-social-icon btn-google" title="Share on Google+">
32+
<span class="fa fa-fw fa-google-plus" aria-hidden="true"></span>
2133
</a>
2234
{% endif %}
2335

2436
<!--- Share on LinkedIn -->
2537
{% if site.share-links-active.linkedin %}
26-
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ site.url }}{{ page.url }}" class="btn btn-social btn-sm btn-linkedin" title="{{ site.data.ui-text[site.locale].share_on_label }} LinkedIn">
27-
<i class="fa fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span>
38+
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ site.url }}{{ page.url }}"
39+
class="btn btn-social-icon btn-linkedin" title="Share on LinkedIn">
40+
<span class="fa fa-fw fa-linkedin" aria-hidden="true"></span>
2841
</a>
2942
{% endif %}
3043

31-
<!-- Check if any share-links are active -->
32-
{% assign any-share-links = false %}
33-
{% for links in site.share-links-active %}
34-
{% if links[1] == true %}
35-
{% assign any-share-links = true %}
36-
{% endif %}
37-
{% endfor %}
38-
39-
<!-- Add an extra space under share links if present -->
40-
{% if any-share-links %}
41-
<br><br/>
42-
{% endif %}
43-
4444
</section>
45+
46+
{% endif %}

_layouts/post.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
<div class="container">
88
<div class="row">
99
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
10+
1011
<article role="main" class="blog-post">
1112
{{ content }}
1213
</article>
13-
{% include social-share.html %}
14+
1415
{% if page.tags.size > 0 %}
1516
<div class="blog-tags">
1617
Tags:
@@ -23,6 +24,11 @@
2324
{% endif %}
2425
</div>
2526
{% endif %}
27+
28+
{% if page.social-share %}
29+
{% include social-share.html %}
30+
{% endif %}
31+
2632
<ul class="pager blog-pager">
2733
{% if page.previous.url %}
2834
<li class="previous">
@@ -35,11 +41,12 @@
3541
</li>
3642
{% endif %}
3743
</ul>
38-
{% if page.comments %}
44+
45+
{% if page.comments %}
3946
<div class="disqus-comments">
40-
{% include disqus.html %}
47+
{% include disqus.html %}
4148
</div>
42-
{% endif %}
49+
{% endif %}
4350
</div>
4451
</div>
45-
</div>
52+
</div>

css/main.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,3 +620,9 @@ td.code pre {
620620
td.gutter {
621621
padding-top: 3px;
622622
}
623+
624+
/* --- Social media sharing section --- */
625+
626+
#social-share-section {
627+
margin-bottom: 30px;
628+
}

0 commit comments

Comments
 (0)