Fix issues with Disqus integration
Brandon Mathis authored on 10/10/2011 at 01:35:45... | ... |
@@ -1,19 +1,19 @@ |
1 | 1 |
{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %} |
2 | 2 |
{% if site.disqus_short_name and page.comments != false %} |
3 | 3 |
<script type="text/javascript"> |
4 |
- (function () { |
|
4 |
+ |
|
5 | 5 |
var disqus_shortname = '{{ site.disqus_short_name }}'; |
6 | 6 |
{% if page.comments == true %} |
7 | 7 |
{% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %} |
8 | 8 |
// var disqus_developer = 1; |
9 | 9 |
var disqus_identifier = '{{ site.url }}{{ page.url }}'; |
10 | 10 |
var disqus_url = '{{ site.url }}{{ page.url }}'; |
11 |
- var disqus_script = 'embed.js' |
|
11 |
+ var disqus_script = 'embed.js'; |
|
12 | 12 |
{% else %} |
13 | 13 |
{% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %} |
14 |
- var disqus_script = 'count.js' |
|
14 |
+ var disqus_script = 'count.js'; |
|
15 | 15 |
{% endif %} |
16 |
- |
|
16 |
+ (function () { |
|
17 | 17 |
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; |
18 | 18 |
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script; |
19 | 19 |
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); |