How to add a comment system to Hexo

2023-08-07
Hexo

Create a public repository to store install the comment system.

https://github.com/foxfromworld/utterances_comments

In stall the Utterances comment system to the repository which was just created.

https://github.com/apps/utterances

Install Utterances in the selected repository.

Enter your settings on the webpage and copy the generated script snippet.

https://utteranc.es/

1
2
3
4
5
6
7
<script src="https://utteranc.es/client.js"
repo="foxfromworld/utterances_comments"
issue-term="url"
theme="github-dark"
crossorigin="anonymous"
async>
</script>

Try leaving your message

Ummm…The function is not working properly. I left one message under one post and it’s appearing on every post.

So I changed issue-term from “url” to “pathname” and the problem is still there…

I applied a new theme to my blog

Add this setting to my-blog/themes/clean-blog/_config.yml

1
2
utterances:
enable: true

Addd the snippet to my-blog/themes/clean-blog/layout/_partial/comments.ejs

1
2
3
4
5
6
7
8
9
<div class="comments" id="comments">
<script src="https://utteranc.es/client.js"
repo="foxfromworld/utterances_comments"
issue-term="pathname"
theme="github-light"
crossorigin="anonymous"
async>
</script>
</div>

Deploy your blog

1
hexo clean && hexo deploy