Based on GitHub Issues commenting system --gitment

Original article in Public number: ape Zhou Xiansen program. This platform is not updated regularly, like my article, I welcome attention to the micro-channel public number.
file

Recently doing personal blog site, you need to review the system, the more popular of several third-party commenting system: to say, the Friends of words, Netease cloud thread, gitment, prior to use too much to say, I feel very good use, but now say server has been shut down, and finally I chose gitment this commenting system, because of personal blog sites face the crowd in favor of the IT field, gitment authorize the use GitHub account login, so you can save the user login and register operations. Gitment comment system is based on the GitHub Issues. Introduced directly supported at the front end, without any back-end code. Can log in page, view, comment, thumbs and other operations, while full Markdown syntax highlighting and support. For a variety of static blog or project page.

1. Registration OAuth Application
into the GitHub official website https://github.com/, click on the top right picture, select the setting
file

After entering the setting selected developer setting
file

Select the new OAuth app
file

The first three parameters can be free to fill, the fourth parameter is very important that the callback URL, this must not fill in the wrong, generally fill in your blog home page address, my current blog is not yet on-line network to the external network penetration test address generating blog so I filled out the callback URL http://zhanyue.natapp1.cc, that is my blog site address filled out click on the Register application
file

After successful registration application, you can get your application Client ID, Client Secret, then here successfully registered.

2. Set a div in HTML, used to place the comment system
file

Comment system required the following two packages:
https://imsun.github.io/gitment/style/default.css

https://imsun.github.io/gitment/dist/gitment.browser.js

Introducing two files directly above it in the interface.

3. Set parameters, rendering comment system
file

Comments system is divided into two parts, the first part of the page rendering estimate can understand, the only caveat is that gitment currently only supports encoding en-US, configuration information of the second part is the review system:

1. id:  我们文章的id,用来区分是哪一篇文章。

1. owner: GitHub账户的username

1. repo: GitHub的仓库名

1. Client_id: 步骤1得到的Client_id

1. Client_secret: 步骤1得到的Client_secret

Here we can successfully build a blog system, let's test it. But gitment of each blog you need to manually initialize Comments (if your blog a lot of history to it a one point of it, but looks like someone wrote a batch script, not tried ha).
file

Comment system successful shows, but it seems there is some problem: Error: Comments Not Initialized, in fact, this is not a problem, because this is the article's comment system has not been initialized, mentioned above gitment each article manually initialized.

Click to login, authentication authority GitHub account login will appear for the first time, log in to complete the authorization will find just disappeared Error
file

Click on the bottom of the initialization comment on this article initialize, then you can normally use the comment system.
file
file

We can see from the chart review system will be available to comment here on the development of plug---gitment GitHub Issues Based complete. Finally, let me say gitment development likely to encounter a few pits it.

1.Error: Not Found issue

owner or repo configuration errors, and pay attention to capitalization and GitHub repository name.

2.Error: Comments Not Initialized
problem or you fill in the callback URL in question, or is that just said you have not log on.

3. Log error [object ProgressEvent]

file

I found a postman test this mistake simply because gitment author of Sao operation, the server has expired, but the authors source code were open, you can own clone source and then placed into the server using my words to use server GitHub a users build their own:
file

Because I was the package downloaded to the local then packaged using a webpack, so find the code directly as shown in gitment.js package, will replace address
file

Then you can successfully use GitHub account to log commented.

Use gitment comment on the system will stop here, welcome to my technical study group together. No. There is a group home public two-dimensional code. Regularly updated learning resources in the group.

No. I personally welcome attention to the public: Program ape Zhou Xiansen
file

Guess you like

Origin www.cnblogs.com/niyueling/p/11563006.html