Hello,
I have this partial template for disqus in a single page post:
{{ if isset .Site.Params "Disqus" }}
<div id="disqus_thread"></div>
<script type="text/javascript">
(function() {
if (window.location.hostname === "localhost") {
return;
}
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
var disqus_shortname = '{{ .Site.Params.Disqus }}';
var disqus_identifier = '{{ with .Params.disqusIdentifier }}{{ . }}{{ else }}{{ .PublishDate.Format $.Site.Params.ISO8601 }}{{ end }}';
var disqus_url = '{{ .Permalink }}';
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
document.getElementById('disqus_thread').appendChild(dsq);
})();
</script>
{{ end }}
When .Params.disqusIdentifier isn’t always available, I want to use the page’s published date in IOS8601 format (or any other date format) as the id.
For some reason the page is only rendering part of the template. I’m not getting an error in the watch console. This is the rendered output:
<script type="text/javascript">
(function() {
if (window.location.hostname === "localhost") {
return;
}
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
var disqus_shortname = 'foobar';
var disqus_identifier = '
What is wrong with my template? Thanks!