Updated disqus script with configuration-variables (#153)
parent
763b612963
commit
762cb66d68
|
@ -1,20 +1,18 @@
|
||||||
<% if (typeof(script) !== 'undefined' && script) { %>
|
<% if (typeof(script) !== 'undefined' && script) { %>
|
||||||
<script>
|
<script>
|
||||||
var disqus_shortname = '<%= theme.comment.disqus %>';
|
var disqus_config = function () {
|
||||||
<% if (page.disqusId) { %>
|
|
||||||
var disqus_identifier = '<%= page.disqusId || page.slug %>';
|
|
||||||
<% } %>
|
|
||||||
<% if (page.permalink) { %>
|
<% if (page.permalink) { %>
|
||||||
var disqus_url = '<%= page.permalink %>';
|
this.page.url = '<%= page.permalink %>';
|
||||||
<% } %>
|
<% } %>
|
||||||
|
this.page.identifier = '<%= page.disqusId || page.slug %>';
|
||||||
|
};
|
||||||
(function() {
|
(function() {
|
||||||
var dsq = document.createElement('script');
|
var d = document, s = d.createElement('script');
|
||||||
dsq.type = 'text/javascript';
|
s.src = '//' + '<%= theme.comment.disqus %>' + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
|
||||||
dsq.async = true;
|
s.setAttribute('data-timestamp', +new Date());
|
||||||
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
|
(d.head || d.body).appendChild(s);
|
||||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div id="disqus_thread">
|
<div id="disqus_thread">
|
||||||
<noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
<noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||||
|
|
Loading…
Reference in New Issue