Browse Source

Include disqus related scripts via macro

Talha Mansoor 11 years ago
parent
commit
1d35773216
2 changed files with 5 additions and 1 deletions
  1. 2 1
      templates/comments.html
  2. 3 0
      templates/disqus_scripts.html

+ 2 - 1
templates/comments.html

@@ -32,6 +32,7 @@
 
 {% macro comments_script(article) %}
     {% if DISQUS_SITENAME and SITEURL and article.status != 'draft' %}
-        {% include 'disqus_scripts.html' %}
+        {% from 'disqus_scripts.html' import disqus_misc_scripts with context %}
+        {{ disqus_misc_scripts() }}
     {% endif %}
 {% endmacro %}

+ 3 - 0
templates/disqus_scripts.html

@@ -1,3 +1,4 @@
+{% macro disqus_misc_scripts() %}
 <script type="text/javascript">
 var disqus_shortname = '{{ DISQUS_SITENAME }}';
 (function () {
@@ -21,3 +22,5 @@ window.onhashchange=function(){
         window.location.reload(true);
 }
 </script>
+{% endmacro %}
+