<div id="disqus_thread">
    {% include "templates/components/single/static_comments.twig" %}
</div>


{% if not user_agent.is_pagespeed %}
<script id="dsq-count-scr" src="//{{disqus.shortname}}.disqus.com/count.js" async></script>
{% endif %}

<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 () {
        this.page.url        = '{{disqus.url}}';         // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = '{{disqus.identifier}}';  // Replace PAGE_IDENTIFIER with your page's unique identifier variable
        this.page.title      = '{{disqus.title}}';
    };

    // Funzione per caricare lo script di Disqus
    function loadDisqus() {
        var d = document, s = d.createElement('script');
        s.src = 'https://{{disqus.shortname}}.disqus.com/embed.js';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    }


    // Variabile per tenere traccia se lo script è stato già caricato
    var disqusLoaded = false;

    // Evento di scroll
    window.addEventListener('scroll', function() {
        if (!disqusLoaded) {
            loadDisqus();
            disqusLoaded = true;
        }
    });
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>