hexo-theme-amane/layout/comment/gitalk.ejs

24 lines
1.2 KiB
Plaintext

<% if (!has_config('comment.owner') || !has_config('comment.admin') || !has_config('comment.repo') || !has_config('comment.client_id') ||
!has_config('comment.client_secret')) { %>
<div class="notification is-danger">
You forgot to set the <code>owner</code>, <code>admin</code>, <code>repo</code>, <code>client_id</code>, or <code>client_secret</code> for Gittalk.
Please set it in <code>_config.yml</code>.
</div>
<% } else { %>
<div id="comment-container"></div>
<%- _css(cdn('gitalk', '1.4.1', 'dist/gitalk.css')) %>
<%- _js(cdn('gitalk', '1.4.1', 'dist/gitalk.min.js')) %>
<script>
var gitalk = new Gitalk({
clientID: '<%= get_config('comment.client_id') %>',
clientSecret: '<%= get_config('comment.client_secret') %>',
id: '<%= md5(path) %>',
repo: '<%= get_config('comment.repo') %>',
owner: '<%= get_config('comment.owner') %>',
admin: <%- JSON.stringify(get_config('comment.admin'))%>,
createIssueManually: <%= get_config('comment.create_issue_manually', false) %>,
distractionFreeMode: <%= get_config('comment.distraction_free_mode', false) %>
})
gitalk.render('comment-container')
</script>
<% } %>