2019-09-01 17:51:06 +00:00
|
|
|
{{- if $.Site.DisqusShortname -}}
|
|
|
|
<div class="site__comments">
|
|
|
|
<div id="disqus_thread"></div>
|
|
|
|
<script type="text/javascript">
|
2019-09-03 06:07:07 +00:00
|
|
|
var disqus_config = function () {
|
|
|
|
this.page.url = "{{ .Permalink }}"; // Replace PAGE_URL with your page's canonical URL variable
|
|
|
|
this.page.identifier = "{{ .Permalink }}"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
|
|
|
|
};
|
|
|
|
|
2019-09-01 17:51:06 +00:00
|
|
|
function loadDisqus() {
|
|
|
|
// Don't ever inject Disqus on localhost--it creates unwanted
|
|
|
|
// discussions from 'localhost:1313' on your Disqus account...
|
|
|
|
if (window.location.hostname == "localhost") {
|
|
|
|
const devWarning = "You're in a development environment. Disqus will not load here.";
|
|
|
|
const disqusThread = document.querySelector("#disqus_thread");
|
|
|
|
|
|
|
|
console.log(devWarning);
|
|
|
|
disqusThread.textContent = devWarning;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-09-03 06:07:07 +00:00
|
|
|
const dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
|
|
|
const disqus_shortname = '{{ $.Site.DisqusShortname }}';
|
2019-09-03 07:00:42 +00:00
|
|
|
dsq.src = "https://" + disqus_shortname + ".disqus.com/embed.js";
|
2019-09-01 17:51:06 +00:00
|
|
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
|
|
|
<button onclick="toggleVisibilityEvent({ event, oneTime: true, callback: loadDisqus })">
|
|
|
|
Load comments
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|