How to add comments to Squarespace Courses using Disqus

Replace YOURSHORTNAME in the code below with your disqus shortname and add the page header code injection for your course.

<script>
document.addEventListener("DOMContentLoaded", function() {
    // Define the Disqus configuration
    var disqus_config = function () {
        this.page.url = window.location.href;  
        this.page.identifier = window.location.pathname;
    };

    // Function to add Disqus to the page
    function addDisqus() {
        // Create the Disqus div
        var disqusDiv = document.createElement('div');
        disqusDiv.id = 'disqus_thread';

        // Find the last article element on the page
        var articles = document.querySelectorAll('article');
        var lastArticle = articles[articles.length - 1];

        // Insert the Disqus div after the last article
        if (lastArticle) {
            lastArticle.parentNode.insertBefore(disqusDiv, lastArticle.nextSibling);
        }

        // Disqus embed script
        var d = document, s = d.createElement('script');
        s.src = 'https://YOURSHORTNAME.disqus.com/embed.js';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    }

    // Add Disqus to the page
    addDisqus();
});
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

Where to find your disqus shortname

Settings > General

Omari Harebin

Omari Harebin is the founder of SQSPThemes. He helps Squarespace designers and product sellers find the market moment inside their existing work, then turn it into articles, offers, demos, and assets that compound.

Start here: Book a free clarity call to get a read on what you already have →

https://www.omariharebin.com
Previous
Previous

How can I build confidence in my decision to leave?

Next
Next

How to customize your Squarespace course labels