Permalink
Browse files

G+/ FB, TW share buttons + Disqus comments for the latest article

  • Loading branch information...
1 parent 038bb1b commit 642ed765612b5acb0fdce6f186da378fce47a5ee @kuba-kubula kuba-kubula committed Jan 10, 2014
Showing with 44 additions and 7 deletions.
  1. +36 −1 _layouts/post.html
  2. +1 −0 _posts/2014-01-09-Inspirational-Resources.md
  3. +7 −6 index.html
View
@@ -1,18 +1,27 @@
---
layout: default
---
+
+{% capture shareLine %}
+<a href="https://twitter.com/share" class="twitter-share-button" data-text="{{ page.title | escape }}" data-url="{{ site.url}}{{ page.url }}" data-via="apiaryio"></a>
+<span class="g-plusone" data-size="medium" data-count="true"></span>
+<span class="fb-share-button" data-send="false" data-href="{{ site.url }}{{ page.url }}" data-type="button_count" data-width="1" data-height="20" data-show-faces="false" data-action="share"></span>
+{% endcapture %}
+
<div class="blog">
{% assign author = site.authors[page.author] %}
<div class="blogArticle">
<a href="/" class="backToArticles">Back to Articles</a>
<h1>{{ page.title }}</h1>
{% if author %}
<p><span class="minority">By</span> <strong>{{ author.display_name }}</strong>
- ({% if author.email %}<a href="https://twitter.com/{{author.twitter}}">{{ author.twitter }}</a>, {% endif %}{% if author.email %}<a href="mailto:{{ author.email }}">{{ author.email }}</a>{% endif %}) <span class="minority">on</span> {{ page.date | date_to_string }}
+ ({% if author.email %}<a href="https://twitter.com/{{author.twitter}}">{{ author.twitter }}</a>, {% endif %}{% if author.email %}<a href="mailto:{{ author.email }}">{{ author.email }}</a>{% endif %}) <span class="minority">on</span>&nbsp;{{ page.date | date_to_string | replace:' ','&nbsp;' }}
</p>
+ <p><span class="blogShare">{{ shareLine }}</span></p>
{% endif %}
{{ content }}
+ <p><span class="blogShare afterArticle">{{ shareLine }}</span></p>
{% if page.comments %}
<a name="comments" id="comments"></a><div id="disqus_thread"></div>
@@ -33,3 +42,29 @@
</div>
</div>
+
+<div id="fb-root"></div>
+
+<script>
+(function(doc, script) {
+ var js,
+ fjs = doc.getElementsByTagName(script)[0],
+ frag = doc.createDocumentFragment(),
+ add = function(url, id) {
+ if (doc.getElementById(id)) {return;}
+ js = doc.createElement(script);
+ js.src = url;
+ id && (js.id = id);
+ frag.appendChild( js );
+ };
+
+ // Google+ button
+ add('http://apis.google.com/js/plusone.js');
+ // Facebook SDK
+ add('//connect.facebook.net/en_US/all.js#xfbml=1', 'facebook-jssdk');
+ // Twitter SDK
+ add('//platform.twitter.com/widgets.js', 'twitter-wjs');
+
+ fjs.parentNode.insertBefore(frag, fjs);
+}(document, 'script'));
+</script>
@@ -5,6 +5,7 @@ layout: post
date: 2014-01-09 10:00:00 +0100
author: zdenek
published: YES
+comments: true
---
Everybody needs an inspiration. Moreover when on the quest for a better API. Inspiring or offending, instructive or just simply time saving – it is often worth looking how others dealt with the challenges one have to face.
View
@@ -6,19 +6,20 @@
<div class="blog">
<div class="blogArticles">
-
+
{% for post in site.posts %}
- <div class="blogPost"><a href="{{ post.url }}" class="shapeshifter">
+ <div class="blogPost"><a href="{{ post.url }}">
<h1>{{ post.title }}</h1>
<p>{{ post.excerpt }}</p>
- <p class="authorDate">{{ site.authors[post.author].name }} — {{ post.date | date_to_string }}</p>
+ <p class="authorDate inline">{{ site.authors[post.author].name }} — {{ post.date | date_to_string }}</p>
+ </a>
{% if post.comments %}
- <p class="commentsLink"><a href="{{ post.url }}#comments" data-disqus-identifier="{{ post.url }}"></a></p>
+ <p class="commentsCount"><a href="{{ post.url }}/#comments" class="commentsLink" data-disqus-identifier="{{ post.url }}"></a></p>
{% assign useComments = true %}
{% endif %}
- </a></div>
+ </div>
{% endfor %}
-
+
</div>
</div>

0 comments on commit 642ed76

Please sign in to comment.