diff options
Diffstat (limited to '.themes/classic/source/_includes')
-rw-r--r-- | .themes/classic/source/_includes/disqus.html | 22 | ||||
-rw-r--r-- | .themes/classic/source/_includes/post/disqus_thread.html | 12 |
2 files changed, 22 insertions, 12 deletions
diff --git a/.themes/classic/source/_includes/disqus.html b/.themes/classic/source/_includes/disqus.html new file mode 100644 index 00000000..4b913534 --- /dev/null +++ b/.themes/classic/source/_includes/disqus.html @@ -0,0 +1,22 @@ +{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %} +{% if site.disqus_short_name and page.comments != false %} +<script type="text/javascript"> + (function () { + var disqus_shortname = '{{ site.disqus_short_name }}'; + {% if page.comments == true %} + {% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %} + // var disqus_developer = 1; + var disqus_identifier = '{{ site.url }}{{ page.url }}'; + var disqus_url = '{{ site.url }}{{ page.url }}'; + var disqus_script = 'embed.js' + {% else %} + {% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %} + var disqus_script = 'count.js' + {% endif %} + + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); + }()); +</script> +{% endif %} diff --git a/.themes/classic/source/_includes/post/disqus_thread.html b/.themes/classic/source/_includes/post/disqus_thread.html index f966f03a..b1acd8cc 100644 --- a/.themes/classic/source/_includes/post/disqus_thread.html +++ b/.themes/classic/source/_includes/post/disqus_thread.html @@ -1,13 +1 @@ -<div id="disqus_thread"></div> -<script type="text/javascript"> - var disqus_shortname = '{{ site.disqus_short_name }}'; - var disqus_identifier = '{{ site.url }}{{ page.url }}'; - var disqus_url = '{{ site.url }}{{ page.url }}'; - //var disqus_developer = 1; - (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); - })(); -</script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> |