Skip to content

Commit

Permalink
Merge pull request getpelican#120 from cdhowie/disqus
Browse files Browse the repository at this point in the history
Gum: Add Disqus support
  • Loading branch information
justinmayer committed Jul 19, 2013
2 parents 96c8cbb + 5624952 commit c9254ce
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gum/templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ <h2 class="entry-title">
<div class="entry-content">
{{ article.content }}
</div><!-- /.entry-content -->
{% if DISQUS_SITENAME %}
<div class="comments">
<h3>Comments</h3>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_identifier = "{{ article.url }}";
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://{{ DISQUS_SITENAME }}.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
</div>
{% endif %}


</div><!-- /.eleven.columns -->
Expand Down
1 change: 1 addition & 0 deletions gum/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ <h1><a href="{{ SITEURL }}">{{ SITENAME }} <strong>{{ SITESUBTITLE }}</strong></
</div>


{% include 'disqus_script.html' %}
<script src="{{ SITEURL }}/theme/js/libs/jquery-1.9.1.min.js"></script>
<script src="{{ SITEURL }}/theme/js/libs/gumby.min.js"></script>
<script src="{{ SITEURL }}/theme/js/plugins.js"></script>
Expand Down
11 changes: 11 additions & 0 deletions gum/templates/disqus_script.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% if DISQUS_SITENAME %}
<script type="text/javascript">
var disqus_shortname = '{{ DISQUS_SITENAME }}';
(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 c9254ce

Please sign in to comment.