Merge pull request #2 from xqwzts/disqus-comments

Enabled Disqus comments on articles if DISQUS_SITENAME property is set.
diff --git a/README.md b/README.md
index 691a719..3e7445e 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,10 @@
 
 - `USER_LOGO_URL` you don't need to replace the logo placeholder, instead put your logo in content/images/your_logo.png and make this point to `SITEURL + '/static/images/your_logo.png'`
 
+- `DISQUS_SITENAME` set this to enable disqus comments in articles
+
+- `COLLAPSE_COMMENTS` set to `True` to have article comments hidden by default. Clicking on the `comments` link will toggle visibility.
+
 - `TAGLINE` some text rendered right below the logo
 
 - `INTERNET_DEFENSE_LEAGUE` set this to `True` if you want to enable the [Internet Defense League](http://internetdefenseleague.org) code
@@ -47,4 +51,4 @@
 
 ## LICENSE
 
-Released under MIT License, full details in `LICENSE` file.
\ No newline at end of file
+Released under MIT License, full details in `LICENSE` file.
diff --git a/templates/article.html b/templates/article.html
index 627623c..c49c2b7 100644
--- a/templates/article.html
+++ b/templates/article.html
@@ -26,10 +26,35 @@
       {% endfor %}
     </p>
     {% endif %}
+    {% if DISQUS_SITENAME %}
+    <p>Comments: <a href="#" onclick="javascript:toggleComments();return false;">toggle</a></p>
+    {% endif %}
   </div>
+
+  {% if DISQUS_SITENAME %}
+    <div id="article_comments" style="display:{%if COLLAPSE_COMMENTS %}none{% else %}block{% endif %}">
+        <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 %}
+
 </article>
 {% endblock %}
 
 {% block footer %}
 <p><a href="{{ SITEURL }}/" class="button_accent">&larr; Back to Index</a></p>
+<script language="javascript">
+    function toggleComments() {
+        var commentDiv = document.getElementById("article_comments");
+        (commentDiv.style.display == "none") ? commentDiv.style.display = "block" : commentDiv.style.display = "none";
+        return false;
+    }
+</script>
 {% endblock %}