Installing utterances commenting system to finally replace Disqus


#1

Hi,

If you don’t know utterances see how it looks here: https://www.danyow.net/
It’s awesome if you ask me. I tried to put it on my own blog and it does not work at the moment.

I’m following the setup guide here: https://utteranc.es/ Steps 1-2-3 are done.
Now I need to embed the script:

I insert the script in my post.hbs file like this:

I reload a post I have on my blog and I can see the script in the source code:

Nothing

Nothing is showing up :frowning:
Any ideas?

technical stuff


CommentBox alternative to Disqus
#2

I currently don’t see any script in your website’s source code.


#3

Getting closer!

I looked in the source code of https://www.danyow.net/aurelia-custom-element-vs-compose/. I saw this:

<!-- Enable comments / https://github.com/utterance/utterances -->
<script>
    (function() {
        if (location.pathname === '/') {
            return;
        }
        var main = document.querySelector('main');
        var script = document.createElement('script');
        script.src='https://utteranc.es/client.js'
        script.setAttribute('repo', 'pascalandy/pascalandy-site');
        script.setAttribute('issue-term', 'pathname');
        main.appendChild(script);
    })();  
</script>

The issue with this is that the comments are appearing in posts and pages. Of course, I would like to have the comments only within my posts :slight_smile:

I guess at this point it’s only a question of formatting the script properly.


#4

Oh you are right. It was gone as I was messing around. It’s back!


#5

Post your post.hbs file here.
If you can’t then add that script of utterance after </footer> tag and under <section class="post-full-comments">


#6

The repo attribute value should be in “owner/repo” format, rather than a full url to the repo.

repo=“pascalandy/pascalandy-site”


#7

@Ayu You are right. Now it works!!
@jdanyow Ah! I missed this one. I would suggest to give a warning or an example :slight_smile:

Solution

<section class="post-full-comments">
  {{!-- Enable comments / https://github.com/utterance/utterances --}}
  <script src="https://utteranc.es/client.js"
          repo="pascalandy/pascalandy-site"
          issue-term="pathname"
          theme="github-light"
          crossorigin="anonymous"
          async>
  </script>
</section>

from my post.hbs file:


#8

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.