啟用 gitalk 留言

  1. 這個網址填資料
  2. 加入下面的片段到_config.yml
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
<% if(page.comments && theme.gitalk.enabled){ %>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/gitalk.css">
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/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