<% if (typeof(script) !== 'undefined' && script) { %>
    <script>
    var disqus_shortname = '<%= theme.comment.disqus %>';
    <% if (page.disqusId) { %>
    var disqus_identifier = '<%= page.disqusId || page.slug %>';
    <% } %>
    <% if (page.permalink) { %>
    var disqus_url = '<%= page.permalink %>';
    <% } %>
    (function() {
    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
    </script>
<% } else { %>
    <div id="disqus_thread">
        <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    </div>
<% } %>