{{ if .Site.Params.disqusShortname }}
<div id="disqus_thread"></div>
<script>
    /**
     *  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
     */
    var disqus_config = function () {
        // Replace PAGE_URL with your page's canonical URL variable
        this.page.url = '{{ .Permalink }}';  
        
        // Replace PAGE_IDENTIFIER with your page's unique identifier variable
        this.page.identifier = '{{ .RelPermalink }}'; 
    };
    (function() {
        var d = document, s = d.createElement('script');
        s.src = 'https://{{.Site.Params.disqusShortname}}.disqus.com/embed.js';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
</script>
<noscript> Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow"> comments powered by Disqus.  </a> </noscript>
{{ end }}

{{ if .Site.Params.enableGitalk }}
<div id="gitalk-container"></div>
{{ end }}

{{ if .Site.Params.livereId }}
<div id="lv-container" data-id="city" data-uid={{.Site.Params.livereId}}>
	<noscript>{{ i18n "comments_activate_js" }}</noscript>
</div>
<script type="text/javascript">
    (function(d, s) {
      var j, e = d.getElementsByTagName(s)[0];
      if (typeof LivereTower === 'function') { return; }
      j = d.createElement(s);
      j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
      j.async = true;
      e.parentNode.insertBefore(j, e);
    })(document, 'script');
</script>
{{ end }}

{{ if .Site.Params.enableTwikoo }}
<div id="tcomment"></div>
<script>
twikoo.init({
    envId: {{.Site.Params.twikooEnvId}},
    el: '#tcomment',
    region: {{.Site.Params.twikooRegion}},
});
</script>
{{ end }}

{{ if .Site.Params.walineServer }}
<div id="waline"></div>
<script>
    Waline.init({
        el: '#waline',
        //path: location.pathname,
        dark: "body.night",
        serverURL: {{.Site.Params.walineServer}} ,
    });
    
    </script>
{{ end }}

{{ if .Site.Params.enableUtterances }}
<script src="https://utteranc.es/client.js"
        repo="{{ .Site.Params.utterances.repo }}"
        issue-term="{{ .Site.Params.utterances.term }}"
        label="{{ .Site.Params.utterances.label }}"
        theme="{{ .Site.Params.utterances.theme }}"
        crossorigin="anonymous"
        async>
</script>
{{ end }}

{{ if .Site.Params.enableGiscus }}
<script src="https://giscus.app/client.js"
        data-repo="{{ .Site.Params.giscus.data_repo}}"
        data-repo-id="{{ .Site.Params.giscus.data_repo_id}}"
        data-category="{{ .Site.Params.giscus.data_category}}"
        data-category-id="{{ .Site.Params.giscus.data_category_id}}"
        data-mapping="{{ .Site.Params.giscus.data_mapping}}"
        data-strict="{{ .Site.Params.giscus.data_strict}}"
        data-reactions-enabled="{{ .Site.Params.giscus.data_reactions_enabled}}"
        data-emit-metadata="{{ .Site.Params.giscus.data_emit_metadata}}"
        data-input-position="{{ .Site.Params.giscus.data_input_position}}"
        data-theme="{{ .Site.Params.giscus.data_theme}}"
        data-lang="{{ .Site.Params.giscus.data_lang}}"
        crossorigin="{{ .Site.Params.giscus.crossorigin}}"
        async>
</script>
{{ end }}