Skip to content

Commit

Permalink
Let's Disqus comments
Browse files Browse the repository at this point in the history
- Disqus counts for articles with comments
  • Loading branch information
kuba-kubula committed Jan 22, 2014
1 parent 29a188c commit 038bb1b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ tracking: >
g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
s.parentNode.insertBefore(g, s); s.parentNode.insertBefore(g, s);
})(document, 'script'); })(document, 'script');
</script> </script>
25 changes: 21 additions & 4 deletions _layouts/post.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,14 +5,31 @@
{% assign author = site.authors[page.author] %} {% assign author = site.authors[page.author] %}
<div class="blogArticle"> <div class="blogArticle">
<a href="/" class="backToArticles">Back to Articles</a> <a href="/" class="backToArticles">Back to Articles</a>

<h1>{{ page.title }}</h1> <h1>{{ page.title }}</h1>
{% if author %} {% if author %}
<p><span class="minority">By</span> <strong>{{ author.display_name }}</strong> <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> {{ page.date | date_to_string }}
</p> </p>
{% endif %} {% endif %}

{{ content }} {{ 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> </div>
26 changes: 18 additions & 8 deletions index.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
title: Welcome title: Welcome
layout: default layout: default
--- ---
<!--<div class="blogHeader mainSectionWrap"> {% assign useComments = false %}
<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>-->


<div class="blog"> <div class="blog">
<div class="blogArticles"> <div class="blogArticles">
Expand All @@ -18,8 +12,24 @@ <h2>Apiary Inside Out</h2>
<h1>{{ post.title }}</h1> <h1>{{ post.title }}</h1>
<p>{{ post.excerpt }}</p> <p>{{ post.excerpt }}</p>
<p class="authorDate">{{ site.authors[post.author].name }} — {{ post.date | date_to_string }}</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> </a></div>
{% endfor %} {% endfor %}


</div> </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.