Commit dc6fdf01 authored by Kaushal Modi's avatar Kaushal Modi

Use {{ with .. }} instead of {{ isset .. }} for disqus check

parent 31e45d1f
......@@ -28,12 +28,14 @@
</div>
{{/* else if not (eq .Site.DisqusShortname "") */}}
<!-- Below works the same way as the above empty-string equality check -->
{{ else if .Site.DisqusShortname }}
<div class="comments clear-float">
<h1>Comments</h1>
{{/* template "_internal/disqus.html" . */}}
{{ partial "disqus" . }}
</div>
{{ else }}
{{ with .Site.DisqusShortname }}
<div class="comments clear-float">
<h1>Comments</h1>
{{/* template "_internal/disqus.html" . */}}
{{ partial "disqus" . }}
</div>
{{ end }}
{{ end }}
{{ end }}
......@@ -4,7 +4,7 @@
/*
https://ascriptersnotes.disqus.com/admin/settings/universalcode/
*/
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
......@@ -27,7 +27,8 @@
s.type = 'text/javascript'; // from https://gohugo.io/extras/comments/#conditional-loading-of-disqus-comments
s.async = true; // from https://gohugo.io/extras/comments/#conditional-loading-of-disqus-comments
var disqus_shortname = '{{ .Site.DisqusShortname }}';
// This code is within the scope of .Site.DisqusShortname, so below {{ . }} is all that's needed.
var disqus_shortname = '{{ . }}';
s.src = '//' + disqus_shortname + '.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment