Create comments file

First create a html file in: layouts/partials/comments.html This is applicable mostly for the PaperMod theme. Other themes usually use a disqus.html file. It is important to name the file in the right way so your theme will recognise it. Check the documentation of your theme, in my case the PaperMod theme documentation about comments is here: https://adityatelange.github.io/hugo-PaperMod/posts/papermod/papermod-features/#comments

Hugo Disqus template

Copy from Hugo repository tpl/tplimpl/embedded/templates/disqus.html

Add all the lines in the previously created comments.html file

I replaced the lines:

{{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}}
{{with .Params.disqus_title }}this.page.title = '{{ . }}';{{end}}
{{with .Params.disqus_url }}this.page.url = '{{ . | html  }}';{{end}}

With these:

this.page.url = '{{ .Permalink }}';
this.page.identifier = '{{ .Permalink }}';
this.page.title = '{{ .Title }}';


If you liked this, consider sending a tip by ko-fi from the button below, and if you want to send me any feedback, you can reach me by email. ko-fi