As other things rely on these variables, they need to be global.

Fixes issues with comments not loading on the blog.  
Semicolons non-optional due to SAFE function http://twitter.com/#!/elijahmanor/status/121980870428069890
This commit is contained in:
Drew Wells 2011-10-09 04:14:27 -03:00
parent e4df98317a
commit 734ee1f31e

View File

@ -1,19 +1,19 @@
{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %} {% 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 %} {% if site.disqus_short_name and page.comments != false %}
<script type="text/javascript"> <script type="text/javascript">
(function () {
var disqus_shortname = '{{ site.disqus_short_name }}'; var disqus_shortname = '{{ site.disqus_short_name }}';
{% if page.comments == true %} {% if page.comments == true %}
{% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %} {% 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_developer = 1;
var disqus_identifier = '{{ site.url }}{{ page.url }}'; var disqus_identifier = '{{ site.url }}{{ page.url }}';
var disqus_url = '{{ site.url }}{{ page.url }}'; var disqus_url = '{{ site.url }}{{ page.url }}';
var disqus_script = 'embed.js' var disqus_script = 'embed.js';
{% else %} {% else %}
{% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %} {% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %}
var disqus_script = 'count.js' var disqus_script = 'count.js';
{% endif %} {% endif %}
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script; dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);