<linkrel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css"><scriptsrc="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script><!-- or --><linkrel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css"><scriptsrc="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
Firstly, you need choose a public github repository (existed or create a new one) for store comments,
Then create A GitHub Application if you don't have one, Click here to register a new one.
Note: You must specify the website domain url in the Authorization callback URL field.
Lastly, you can choose how to apply to the page as below:
Method One
Add a container to your page:
<divid="gitalk-container"></div>
Then use the Javascript code below to generate the gitalk plugin:
constgitalk=newGitalk({clientID: 'GitHub Application Client ID',clientSecret: 'GitHub Application Client Secret',repo: 'GitHub repo',// The repository of store comments,owner: 'GitHub repo owner',admin: ['GitHub repo owner and collaborators, only these guys can initialize github issues'],id: location.pathname,// Ensure uniqueness and length less than 50distractionFreeMode: false// Facebook-like distraction free mode})gitalk.render('gitalk-container')
Localization language key, support [en, zh-CN, zh-TW, es-ES, fr, ru, de, pl, ko, fa, ja].
perPageNumber
Default: 10.
Pagination size, with maximum 100.
distractionFreeModeBoolean
Default: false.
Facebook-like distraction free mode.
pagerDirectionString
Default: 'last'
Comment sorting direction, available values are last and first.
createIssueManuallyBoolean
Default: false.
By default, Gitalk will create a corresponding github issue for your every single page automatically when the logined user is belong to the admin users. You can create it manually by setting this option to true.
请发表评论