<% if (typeof(script) !== 'undefined' && script) { %>
    <script>
    var disqus_config = function () {
        <% if (page.permalink) { %>
            this.page.url = '<%= page.permalink %>';
        <% } %>
        this.page.identifier = '<%= page.disqusId || page.slug %>';
    };
    (function() { 
        var d = document, s = d.createElement('script');  
        s.src = '//' + '<%= theme.comment.disqus %>' + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
</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>
<% } %>