Note
This article was automatically translated using Google
It has been more than a year since I transferred the article to hexo, and it is very smooth to use, but the comment system has not been very satisfactory. I was thinking about it, I am afraid that no one will read this stuff for a few years, because there are a lot of “you know” things written in the essay, so I have no motivation to do SEO, just let it go
However, there are still some things in the experience sharing, which may be helpful to some people, even if not. In case I want to make some new things one day, I can come back and look through it. After all, I have forgotten a lot of configurations after a long time, and it is very troublesome to search.
When I came up, I saw one or two people set up according to my operation, which is very good. But some time ago, I changed the structure of the website and changed the code of the home page, which led to a change in the path of experience sharing articles, and the previous comments disappeared. I am a little sorry for others. Moreover, I am not very satisfied with what gitalk, valine, and qisqus are used. Now that github has been prostituted to the end, maybe a warehouse can also realize the comment function. Thinking of this, I searched and found a good thing utteranc
This is a comment function based on the issues of the github warehouse. The principle is very simple, that is, to hang each article in the issues as a question, and then the people behind can comment on this question, and it also supports emoticons. The function is very complete.
As for some people who don’t have a github account? Those people may not have the need to comment, hahaha
1. Create a Github warehouse
2. Add Github App
This is mainly used to automatically create an Issue and associate it with the article address according to the rules when others comment. Of course, if you are not at ease, you can build a set of automatic adding programs yourself, it’s just a little troublesome, and it’s not necessary
Address: https://github.com/apps/utterances
Visit the address, enter the installation page, and click the Install
button
Then select the newly built warehouse and click Install
3. Get the web page code
Enter hereutteranc, fill in Repository according to the instructions, select the corresponding method of the article and Issue (recommended to use the default), Issue Label if It is enough to create a new warehouse and leave it blank. If you want to use the original warehouse, you can add a label (no problem if you don’t add it, because there should be less Issues in that warehouse), Theme select it, and finally You will see the insertion code in the place of Enable Utterances, copy it out
4. Insert the corresponding area of the theme
At present, many themes should have started to support utterances. It doesn’t matter if they don’t support it. Just find the comment area of the original article. There is a separate comments.ejs
to manage the place where the Oranges theme inserts comments. Add an open button, and then copy the above code into it, just pass the parameters or something, mainly because of my theme, you may not see the original Oranges after reading the code, it was changed by a pass.. .
5. Principle of use
After deployment, you will see a utterances comment area under each article. It should be noted that there is no Issue associated with this article in the comment library at this time, only the utterances when the first comment is initiated. The github app will help you create a new Issue associated with this article. This is the background logic. For the actual user experience, this step is invisible, enjoy.