Featured image of post gitalk

gitalk

啟用 gitalk 留言

  1. 這個網址填資料
  2. 加入下面的片段到_config.yml
1
2
3
4
5
6
7
8
9
disqus:
    enabled: false
gitalk:
    enabled: true
    owner: <username>
    repo: <username>.github.io
    admin: ['<username>']
    clientID: <clientID>
    clientSecret: <clientSecret>
  1. 加入下面的片段到themes/cactus/layout/_partial/comments.ejs
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<% if(page.comments && theme.gitalk.enabled){ %>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
    <script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
    <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js"></script>
    <div id="gitalk-container"></div>
    <script type="text/javascript">
        var gitalk = new Gitalk({
            clientID: '<%= theme.gitalk.clientID %>',
            clientSecret: '<%= theme.gitalk.clientSecret %>',
            id: md5(window.location.pathname),
            repo: '<%= theme.gitalk.repo %>',
            owner: '<%= theme.gitalk.owner %>',
            admin: '<%= theme.gitalk.admin %>',
            distractionFreeMode: '<%= theme.gitalk.on %>'
        })
        gitalk.render('gitalk-container')
    </script>
<% } %>
  1. 完成!注意 gitalk 在本地端是沒有用的喔!記得 hexo g; hexo d
好想養貓阿~~
使用 Hugo 建立
主題 StackJimmy 設計