hexo/node_modules/hexo-theme-fluid/layout/_partials/comments/disqus.ejs

33 lines
1.3 KiB
Plaintext

<% if (theme.disqus.shortname) { %>
<div class="disqus" style="width:100%">
<div id="disqus_thread"></div>
<% if (theme.disqus.disqusjs) { %>
<script>
Fluid.utils.loadComments('#disqus_thread', function() {
Fluid.utils.createCssLink('<%= url_join(theme.static_prefix.disqusjs, 'disqusjs.css') %>');
Fluid.utils.createScript('<%= url_join(theme.static_prefix.disqusjs, 'disqus.js') %>', function() {
new DisqusJS({
shortname: '<%= theme.disqus.shortname %>',
apikey: '<%= theme.disqus.apikey %>'
});
});
});
</script>
<% } else { %>
<script type="text/javascript">
var disqus_config = function() {
this.page.url = '<%= page.permalink %>';
this.page.identifier = '<%= url_for(page.path) %>';
};
Fluid.utils.loadComments('#disqus_thread', function() {
var d = document, s = d.createElement('script');
s.src = '//' + '<%= theme.disqus.shortname %>' + '.disqus.com/embed.js';
s.setAttribute('data-timestamp', new Date());
(d.head || d.body).appendChild(s);
});
</script>
<% } %>
<noscript>Please enable JavaScript to view the comments</noscript>
</div>
<% } %>