2011-09-21 07:37:59 -04:00
|
|
|
{% 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">
|
|
|
|
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;
|
2011-10-21 08:04:34 -04:00
|
|
|
var disqus_identifier = '{{ canonical }}';
|
|
|
|
var disqus_url = '{{ canonical }}';
|
2011-10-09 03:14:27 -04:00
|
|
|
var disqus_script = 'embed.js';
|
2011-09-21 07:37:59 -04:00
|
|
|
{% else %}
|
|
|
|
{% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %}
|
2011-10-09 03:14:27 -04:00
|
|
|
var disqus_script = 'count.js';
|
2011-09-21 07:37:59 -04:00
|
|
|
{% endif %}
|
2011-10-09 03:14:27 -04:00
|
|
|
(function () {
|
2011-09-21 07:37:59 -04:00
|
|
|
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 %}
|