Allow Disqus comments to be collapsed (again)
diff --git a/README.md b/README.md
index 90cc361..02fec98 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,7 @@
- Supports displaying a custom list of links with icons in the sidebar
- Global keyword support
- Fuzzy date display using Javascript
+- Disqus comment integration
## Installing
@@ -36,6 +37,7 @@
- `GOOGLE_PLUS_URL`: A link to your Google+ profile. Used for the [Google Authorship](http://www.google.com/insidesearch/features/authorship/index.html) feature.
- `USER_LOGO_URL`: The image to display as the profile image. Can be local or a remote URL.
- `DISQUS_SITENAME`: Set this to enable Disqus comments on articles.
+- `DISQUS_COLLAPSED`: Set to `True` to have article comments hidden by default. Clicking a link on the page will load them.
- `TAGLINE`: The site's tagline. Rendered right below the image.
- `SCROLL_TO_CONTENT`: If this is set to `True`, when content is below the sidebar (for example, on mobile), the page will be scrolled down to the content when it loads. An exception is made for the home page.
- `MANGLE_EMAILS`: If enabled, any emails in the `SOCIAL` links will be obfuscated in HTML and have their links generated by Javascript when the page loads.
diff --git a/static/css/style.less b/static/css/style.less
index e1be931..904ef63 100644
--- a/static/css/style.less
+++ b/static/css/style.less
@@ -263,6 +263,15 @@
font-size: 12px;
color: @med-grey;
}
+
+ div#article_comments{
+ padding-top: 10px;
+ padding-bottom: 10px;
+
+ i {
+ padding-right: 10px;
+ }
+ }
}
footer {
diff --git a/templates/article.html b/templates/article.html
index b4108b6..0a7c43b 100644
--- a/templates/article.html
+++ b/templates/article.html
@@ -47,18 +47,27 @@
</div>
{% if DISQUS_SITENAME %}
- <div id="article_comments">
- <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 = '//{{ DISQUS_SITENAME }}.disqus.com/embed.js';
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
- })();
- </script>
- <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+ <div id="article_comments">
+ <div id="disqus_thread">
+ {% if DISQUS_COLLAPSED %}
+ <a href="javascript:loadDisqus()"><i class="fa fa-comments fa-lg"></i>Click to load comments</a>
+ {% endif %}
</div>
+ </div>
+
+ <script type="text/javascript">
+ var disqus_identifier = "{{ article.url }}";
+ loadDisqus = function() {
+ var dsq = document.createElement('script');
+ dsq.type = 'text/javascript';
+ dsq.async = true;
+ dsq.src = '//{{ DISQUS_SITENAME }}.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ };
+ {% if not DISQUS_COLLAPSED %}
+ loadDisqus();
+ {% endif %}
+ </script>
{% endif %}
</article>
{% endblock %}