summaryrefslogtreecommitdiff
path: root/layouts/partials/disqus_script.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/disqus_script.html')
-rw-r--r--layouts/partials/disqus_script.html27
1 files changed, 27 insertions, 0 deletions
diff --git a/layouts/partials/disqus_script.html b/layouts/partials/disqus_script.html
new file mode 100644
index 0000000..4840d14
--- /dev/null
+++ b/layouts/partials/disqus_script.html
@@ -0,0 +1,27 @@
+<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>