In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what gitment is, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!
Gitment is a comment system based on GitHub Issues. Support for direct introduction at the front end without any back-end code. You can log in, view, comment, like and other operations on the page, with complete Markdown and code highlighting support. Suitable for a variety of static blog or project pages.
1. Register for OAuth Application
Enter the GitHub website https://github.com/, click on the avatar in the upper right corner, and select setting
Select developer setting after entering setting
Select new OAuth app
The first three parameters can be filled in at will, the fourth parameter is very important, it is callback URL, this must not be wrong, generally fill in your blog home page address, my blog is not online yet is the internal network penetration to the external network to generate blog test address, so I callback URL filled in http://zhanyue.natapp1.cc, that is, my blog home page address, fill in and click Register application
After registering the application successfully, you can get the Client ID and Client Secret of your application, and then register here successfully.
two。 Set up a div in HTML to place the comment system
The comment system requires the following two packages: https://imsun.github.io/gitment/style/default.css
Https://imsun.github.io/gitment/dist/gitment.browser.js
Directly introduce the above two files into the interface.
3. Set parameters, render comment system
The review system is divided into two parts. The first part of the rendering page is estimated to be readable. The only thing to note is that gitment only supports encoding en-US. The second part is the configuration information of the review system:
1.id: the id of our article is used to distinguish which article.
2.owner: the username of the GitHub account
3.repo: the warehouse name of GitHub
4.Client_id: Client_id obtained from step 1
5.Client_secret: Client_secret obtained from step 1
At this point, we can successfully build a blog system, let's test it. However, gitment requires you to manually initialize the comment function for each blog (if you have a lot of history blogs, click on them, but it looks like someone has written a batch processing script and hasn't tried it).
The comment system is displayed successfully, but there seems to be a problem: Error: Comments Not Initialized, in fact, this is not a problem, this is because the comment system of this article has not been initialized, as mentioned above, gitment needs to initialize each article manually.
Click to log in, the first time there will be authorization GitHub account login verification, authorization login will be completed will find that the Error just disappeared
Click the initialization comment at the bottom to initialize this article, and then you can use the comment system normally.
From the figure, we can see that the comment system can be used normally, and here the development of the GitHub Issues-based comment plug-in-gitment is complete. Finally, let's talk about a few holes that are easy to encounter in gitment development.
1.Error: Not Found problem
Owner or repo is misconfigured. Pay attention to the case of GitHub and repository names.
2.Error: Comments Not Initialized
This question is either you call back URL to fill in a problem, or you have not logged in as mentioned just now.
3. Login error [object ProgressEvent]
I tested with postman and found that this error is entirely due to the coquettish operation of the gitment author. The server has expired, but the author's source code is open so that he can clone the source code and then put it to the server to use. In my words, I use a server built by a netizen in GitHub:
Because I downloaded the package locally and packaged it with webpack, I found the code shown in the gitment.js package directly and changed the address to
Then you can successfully use your GitHub account to log in and comment.
The above is all the content of this article "what is gitment?" thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.