hexo-theme-indigo icon indicating copy to clipboard operation
hexo-theme-indigo copied to clipboard

添加gitalk后,没有出现评论框

Open Chankin026 opened this issue 6 years ago • 1 comments

在\layout_partial\plugins 下新建了 了gitalk.ejs文件

<% if (theme.gitalk.enable){ %>
<section class="comments" id="comments">
    <div id="gitalk_thread"></div>
    <link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
    <script src="//unpkg.com/gitalk/dist/gitalk.min.js"></script>
    <script type="text/javascript">
      var gitalk = new Gitalk({
        clientID: '<%= theme.gitalk.clientID %>',
        clientSecret: '<%= theme.gitalk.clientSecret %>',
        repo: '<%= theme.gitalk.repo %>',
        owner: '<%= theme.gitalk.owner %>',
        admin: '<%= theme.gitalk.admin %>'
        id: location.pathname,
        distractionFreeMode: '<%= theme.gitalk.distractionFreeMode %>'
      })
        gitalk.render('comments')
    </script>
</section>
<% } %>

接着在\layout_partial\post\comment.ejs 中加入 <%- partial('../plugins/gitalk') %> 最后在主题配置文件中加入

gitalk:
  enable: true 
  owner: Chankin026
  repo: Chankin026.github.io #储存评论issue的github仓库名
  admin: Chankin026 #Github 用户名,
  clientID: 739c72719c8bea0193fd #`Github Application clientID`
  clientSecret: ****************************** 
  distractionFreeMode: true

清除缓存生成部署后 还是没有

Chankin026 avatar Sep 27 '18 09:09 Chankin026

链接

Chankin026 avatar Sep 27 '18 09:09 Chankin026