Assistance with Utterances commenting plugin

Can someone please help me add the Utterances commenting plugin to the Hugo-goa, a Hugo theme? I’ve added the HTML file into the folder structure of my site theme but I don’t know/understand how to reference it in my config.toml file, can someone help me a complete noob?

I’ve commented out discuss Discuss commenting but add its replacement.

And link to your repo?

Here is a link to the Hugo-goa theme. My commenting repo is here. There is nothing in it, it was made for the commenting setup only.

In a separate question, is there a way to make the Utterances controlled by the theme’s front matter so the author can designate whether a page gets comments or not?

So, for example…

---
Author: me
title: My title
published: true
comments: false
---

On another page the comment visibility may be true.

Set comments: false` to the pages you want to exclude comments on, then wrap your utterances code with a command like below

{{- if (not (isset .Params "comments")) }}
<!-- your Utterances code here -->
{{- end }}

What @vado mentions shall be enough. You just need to paste it into your relevant layout (in that case content.html).

I know that utterances is quite popular and it’s a good solution but personally would recommend thinking about activating discussions in GitHub and using Giscus for comments.

I still need help. How do I associate this code with something on my config.toml file?

Like what?

You don’t. You paste it into your layout where it supposed to be displayed. There is nothing to associate.

I’ve done that then. Nothing has changed.

I edited the code. Try it again.

I made the edits, nothing changed

{{- if (not (isset .Params "comments")) }}
<script src="https://utteranc.es/client.js"
        repo="bocciaman/site-comments.git"
        issue-term="pathname"
        label="Blog"
        theme="github-light"
        crossorigin="anonymous"
        async>
</script>
{{- end }}

Nothing changed!

I should also ask, will the comment section appear if the site is still using the localhost to preview?

Are you sure you have configured Utterances correctly?

I think so, what can I share to confirm?

I don’t use utterances. Does the comment box show up when you jut paste the script without wrapping it with the Hugo code?

No, that why I thought I’m missing something that should be in the config.toml page.

Try below:

  {{ if .Params.comments }}
  <script src="https://utteranc.es/client.js"
        repo="bocciaman/site-comments.git"
        issue-term="pathname"
        label="Blog"
        theme="github-light"
        crossorigin="anonymous"
        async>
</script>
{{ end }}

set in post frontmatter in which this need to be displayed

comments: true

and pass the link where is implemented live to have a look.

I might be wrong, but perhaps you have not implemented utterances properly. I tested the code I shared and in pages where the comments: false is set, the script does not show up in the source code. So, I advise you troubleshoot the installation again (you can also test in production and see).

Exactly.
I see code loading in console but not displaying.
Try to implement it to see if it’s working before adding conditions to when need to be displayed.

You also have to decide i you want the comments on or off by default. But troubleshoot your installation and get back. This seems to be an Utterances issue, not a Hugo issue.