'use strict'; const { Component, Fragment } = require('inferno'); const { cacheComponent } = require('../util/cache'); class Disqus extends Component { render() { const { shortname, disqusId, path, permalink } = this.props; if (!shortname) { return
You forgot to set the shortname for Disqus. Please set it in _config.yml.
; } const js = `var disqus_config = function () { this.page.url = '${permalink}'; this.page.identifier = '${disqusId || path}'; }; (function() { var d = document, s = d.createElement('script'); s.src = '//' + '${shortname}' + '.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })();`; return
; } } module.exports = cacheComponent(Disqus, 'comment.disqus', props => { const { comment, page } = props; return { path: page.path, shortname: comment.shortname, disqusId: page.disqusId, permalink: page.permalink }; });