added share buttons

This commit is contained in:
Panos Sakkos 2015-07-06 22:54:17 +02:00
parent 1c48a2ea56
commit 9097864f05
5 changed files with 67 additions and 3 deletions

View file

@ -28,7 +28,11 @@ me-img: "/img/me.jpg"
# Blog variables
post-preview-words: 128
fb-share: True
twitter-share: True
reddit-share: True
# Career variables
events:
@ -51,7 +55,7 @@ events:
date: "October 2007 - September 2011"
description: "Bachelor studies @ <a href=\"http://www.di.uoa.gr/eng\" target=\"_blank\">Department of Informatics and Telecommunications</a> on Computer Science and Telecomunications"
# Firt image of the Career timeline
# First image of the Career timeline
career-img: "/img/career/default.jpg"
# Social networks variables (many more available: facebook, flickr, dribbble, pinterest, instagram, tumblr etc.)

View file

@ -21,6 +21,25 @@
</script>
{% endif %}
<!-- Share buttons -->
{% if site.twitter-share %}
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
{% endif %}
{% if site.fb-share %}
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
{% endif %}
<!-- Disqus -->
{% if site.disqus-shortname %}
<script type="text/javascript">
var disqus_shortname = '{{ site.disqus-shortname }}';

19
_includes/share.html Normal file
View file

@ -0,0 +1,19 @@
{% if site.fb-share %}
<div style="float:left; padding: 0 5px; vertical-align:top">
<div class="fb-share-button" data-href="{{ site.url }}{{ page.url }}" data-layout="button_count"></div>
</div>
{% endif %}
{% if site.twitter-share %}
<div style="float:left; padding: 0 5px; vertical-align:top">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="{{ site.url }}{{ page.url }}" data-text="{{ page.title }}"></a>
</div>
{% endif %}
{% if site.reddit-share %}
<div style="float:left; padding: 0 5px; vertical-align:top">
<script type="text/javascript">reddit_newwindow='1'</script>
<script type="text/javascript">reddit_target='technology'</script>
<script type="text/javascript">reddit_title='{{ page.title }}'</script>
<script type="text/javascript">reddit_url='{{ site.url }}/{{ page.url }}'</script>
<script type="text/javascript" src="//www.redditstatic.com/button/button1.js"></script>
</div>
{% endif %}

View file

@ -15,7 +15,9 @@
<h4><strong>{{ page.date | date_to_string }}</strong><small> . {{ page.category }} . <a href="{{ site.url }}{{ page.url }}#disqus_thread">Comments</a></small></h4>
{{ page.content | markdownify }}
{% include share.html %}
{% include comments.html %}
</div>

View file

@ -18,6 +18,7 @@
* Blogging functionality
* Preview of the latest post in the home page
* Archive page
* Facebook, Twitter and Reddit share buttons
* Disqus comments
* Control of your website and blog through the site's config file
* Favicon
@ -99,6 +100,25 @@ This variable dicates how many words do you want to display as preview in the Bl
post-preview-words: 128
````
### Share buttons
Set to False to remove the respective button
#### Facebook
````
fb-share: True
````
#### Twitter share button
Set to False to not include the button
````
twitter-share: True
````
#### Reddit share button
````
reddit-share: True
````
### Timeline Events
The Timeline is displayed in the Career section of the homepage. Each event consists of a date (when did the event started and ended), an image and a description.
````