1. Michael Shepanski
  2. pushingkarma

Commits

Michael Shepanski  committed ab82d91

Better Disqus integration (maybe)

  • Participants
  • Parent commits 23ebe84
  • Branches default

Comments (0)

Files changed (2)

File themes/v2-hardwood/templates/blog/listposts.html

View file
 <div class='listposts'>
   {% for post in posts.object_list %}
     <div class='blogpost {% if forloop.first %}first{% endif %}'>
-      <h1><a href='{{ post.get_absolute_url|safe }}'>{{ post.title }}</a></h1>
+      <h1><a href='{{post.get_absolute_url|safe}}'>{{ post.title }}</a></h1>
       <div class='authordetails'>
         <div class='authors'>{{ post.authors }}</div>
         <div class='date'>{{ post.publish|date:"F j, Y" }}</div>
         <div class='ncomments'>
-          <i class="icon-comment"></i> XX Comments
-          {# {% if post.comments.count %}<a href='{{ post.get_absolute_url|safe }}#comments'>XX comments</a> #}
-          {# {% else %}XX comments{% endif %} #}
+          <i class="icon-comment"></i>
+          <a href='{{post.get_absolute_url|safe}}#disqus_thread' data-disqus-identifier='{{post.id}}'>0 Comments</a>
         </div>
         <div class='tags'>
           {% for tag in post.get_tags %}
     </div>
     {% if not forloop.last %}<hr class='fancyhr'/>{% endif %}
   {% endfor %}
+
+  <script type="text/javascript">
+    (function () {
+        var disqus_shortname = 'pushingkarma';
+        var disqus_developer = {{DEBUG|yesno:"1,0"}};
+        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>
 </div>
 {% include "blog/pagenav.html" %}

File themes/v2-hardwood/templates/blog/post.html

View file
   <div class='authordetails'>
     <div class='authors'>{{ post.authors }}</div>
     <div class='date'>{{ post.publish|date:"F j, Y" }}</div>
-    <div class='ncomments'><i class="icon-comment"></i> XX comments</div>
+    <div class='ncomments'>
+      <i class="icon-comment"></i>
+      <a href='{{post.get_absolute_url|safe}}#disqus_thread' data-disqus-identifier='{{post.id}}'>0 Comments</a>
+    </div>
     <div class='tags'>
       {% for tag in post.get_tags %}
         {% if forloop.first %}<i class="icon-tags"></i>{% endif %}
   {% if post.allow_comments %}
     <div id="disqus_thread"></div>
     <script type="text/javascript">
-        var disqus_shortname = 'pushingkarma';
-        var disqus_title = 'Hello world!';
-        (function() {
-            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
-            dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
+      (function() {
+          var disqus_shortname = 'pushingkarma';
+          var disqus_identifier = '{{post.id}}';
+          var disqus_title = '{{post.title}}';
+          var disqus_developer = {{DEBUG|yesno:"1,0"}};
+          var dsq = document.createElement('script');
+          dsq.type = 'text/javascript';
+          dsq.async = true;
+          dsq.src = 'http://'+ disqus_shortname +'.disqus.com/embed.js';
+          (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+
+          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>
     <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>