Add Disqus comments to post layout

This commit is contained in:
Michael Rose 2013-06-26 09:18:48 -04:00
parent ce989aec0b
commit 92c281453f
4 changed files with 26 additions and 1 deletions

View file

@ -1,6 +1,7 @@
title: So Simple Theme title: So Simple Theme
description: A simple and clean responsive Jekyll theme for words and photos. description: A simple and clean responsive Jekyll theme for words and photos.
logo: site-logo.png logo: site-logo.png
disqus_shortname: sosimpletheme
#Comment out url when working locally to resolve base urls correctly #Comment out url when working locally to resolve base urls correctly
url: http://mmistakes.github.io/so-simple-theme url: http://mmistakes.github.io/so-simple-theme

View file

@ -0,0 +1,21 @@
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '{{ site.disqus_shortname }}'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(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);
})();
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

View file

@ -16,3 +16,4 @@
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})(); })();
</script> </script>
{% include disqus_comments.html %}

View file

@ -24,10 +24,12 @@
<img src="{{ site.url }}/images/{{ site.owner.avatar }}" alt="{{ site.owner.name }} photo" class="author-photo"> <img src="{{ site.url }}/images/{{ site.owner.avatar }}" alt="{{ site.owner.name }} photo" class="author-photo">
<span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">By <span itemprop="name"><a href="{{ site.url }}/about" title="About {{ site.owner.name }}" itemprop="url">{{ site.owner.name }}</a></span></span> <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">By <span itemprop="name"><a href="{{ site.url }}/about" title="About {{ site.owner.name }}" itemprop="url">{{ site.owner.name }}</a></span></span>
<span class="entry-date"><time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%B %d, %Y" }}</time></span> <span class="entry-date"><time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%B %d, %Y" }}</time></span>
{% if page.comments %}<span class="entry-comments"><a href="#disqus_thread">Comment</a></span>{% endif %}
<span><a href="{{ site.url }}{{ page.url }}" rel="bookmark" title="{{ page.title }}"><i class="icon-link"></i> Permalink</a></span> <span><a href="{{ site.url }}{{ page.url }}" rel="bookmark" title="{{ page.title }}"><i class="icon-link"></i> Permalink</a></span>
</footer> </footer>
<div class="entry-content"> <div class="entry-content">
{{ content }} {{ content }}
{% if page.comments %}<div id="disqus_thread"></div><!-- /#disqus_thread -->{% endif %}
</div><!-- /.entry-content --> </div><!-- /.entry-content -->
</div><!-- /.entry-wrapper --> </div><!-- /.entry-wrapper -->
</article> </article>