PaperModX/layouts/partials/disqus_script.html

28 lines
1.0 KiB
HTML
Raw Normal View History

<script type="text/javascript">
var disqus_config = function () {
this.page.url = '{{ .Page.Permalink }}'; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = '{{ .Page.Permalink | path.Base }}'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function () {
let disqusEmbedLoaded = window.disqusEmbedLoaded;
if (disqusEmbedLoaded) {
// Use DISQUS.reset instead of reloading embed.js please.
// https://help.disqus.com/en/articles/1717163-using-disqus-on-ajax-sites
DISQUS.reset({
reload: true,
config: disqus_config,
});
} else {
var d = document, s = d.createElement('script');
s.src = '//' + '{{ site.Params.commentSystem.disqus.shortname }}' + '.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
// prevent the <script> from loading mutiple times by InstantClick
s.setAttribute('data-no-instant', '')
d.head.appendChild(s);
window.disqusEmbedLoaded = true;
}
})();
</script>