hexo-theme-ayer/layout/_partial/post/gitalk.ejs
hankzhangcn b1def36445
添加关闭gitalk评论区的front-matter
在文章头添加`comment: false`可以关闭单篇文章的gitalk评论区。
2020-11-26 15:12:08 +08:00

22 lines
877 B
JavaScript

<% if (theme.gitalk.enable && post.comment!=false) { %>
<div class="gitalk" id="gitalk-container"></div>
<%- css('https://cdn.jsdelivr.net/npm/gitalk@1.6.2/dist/gitalk.css') %>
<%- js('https://cdn.jsdelivr.net/npm/gitalk@1.6.2/dist/gitalk.min.js') %>
<%- js('https://cdn.jsdelivr.net/npm/blueimp-md5@2.10.0/js/md5.min.js') %>
<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, // Ensure uniqueness and length less than 50
id: md5(location.pathname),
distractionFreeMode: false, // Facebook-like distraction free mode
pagerDirection: 'last'
})
gitalk.render('gitalk-container')
</script>
<% } %>