Permalink
Browse files

Let's Disqus comments

- Disqus counts for articles with comments
  • Loading branch information...
kuba-kubula committed Jan 10, 2014
1 parent 29a188c commit 038bb1bf9bfa5ab3cfb66dc9405f157278b4472e
Showing with 40 additions and 13 deletions.
  1. +1 −1 _config.yml
  2. +21 −4 _layouts/post.html
  3. +18 −8 index.html
View
@@ -52,4 +52,4 @@ tracking: >
g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
s.parentNode.insertBefore(g, s);
})(document, 'script');
- </script>
+ </script>
View
@@ -5,14 +5,31 @@
{% assign author = site.authors[page.author] %}
<div class="blogArticle">
<a href="/" class="backToArticles">Back to Articles</a>
-
<h1>{{ page.title }}</h1>
- {% if author %}
+ {% 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 }}
</p>
{% endif %}
-
+
{{ content }}
+
+{% if page.comments %}
+ <a name="comments" id="comments"></a><div id="disqus_thread"></div>
+ <script type="text/javascript">
+ var disqus_title = '{{ page.title | escape }}';
+ var disqus_url = '{{ site.url }}{{ page.url }}';
+ var disqus_identifier = '{{ page.url }}';
+ var disqus_shortname = 'apiaryblog';
+ (function() {
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
+ </script>
+ <noscript><p>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></p></noscript>
+ <p><a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a></p>
+{% endif %}
+
</div>
-</div>
+</div>
View
@@ -2,13 +2,7 @@
title: Welcome
layout: default
---
-<!--<div class="blogHeader mainSectionWrap">
- <div class="positioning">
- <h1 class="largerTopSpace">All things Apiary</h1>
- <h2>Apiary Inside Out</h2>
- <p>We are all very lucky. We build stuff for developers. We have big dreams. We work hard &amp; fast, but don't cut corners. We take pride in being early adopters—In Wayne Gretzky's terms: “skating where the puck is going to be”.</p>
- </div>
-</div>-->
+{% assign useComments = false %}
<div class="blog">
<div class="blogArticles">
@@ -18,8 +12,24 @@ <h2>Apiary Inside Out</h2>
<h1>{{ post.title }}</h1>
<p>{{ post.excerpt }}</p>
<p class="authorDate">{{ site.authors[post.author].name }} — {{ post.date | date_to_string }}</p>
+ {% if post.comments %}
+ <p class="commentsLink"><a href="{{ post.url }}#comments" data-disqus-identifier="{{ post.url }}"></a></p>
+ {% assign useComments = true %}
+ {% endif %}
</a></div>
{% endfor %}
</div>
-</div>
+</div>
+
+{% if useComments %}
+<script type="text/javascript">
+var disqus_shortname = 'apiaryblog';
+(function () {
+var s = document.createElement('script'); s.async = true;
+s.type = 'text/javascript';
+s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
+(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
+}());
+</script>
+{% endif %}

0 comments on commit 038bb1b

Please sign in to comment.