style(gitalk): gitalk.ejs code optimization

This commit is contained in:
XPoet 2022-09-23 14:23:26 +08:00
parent f316f865cd
commit 2d80c45ec5
1 changed files with 36 additions and 33 deletions

View File

@ -1,9 +1,11 @@
<% const { client_id, client_secret, repository, github_id, github_admins } = theme.comment.gitalk %>
<% if(
theme.comment.use === 'gitalk'
&& theme.comment.gitalk.client_id
&& theme.comment.gitalk.client_secret
&& theme.comment.gitalk.github_id
&& theme.comment.gitalk.repository
&& client_id
&& client_secret
&& github_id
&& repository
) { %>
<div id="gitalk-container"></div>
<script <%= theme.pjax.enable === true ? 'data-pjax' : '' %>
@ -19,12 +21,13 @@
}
try {
Gitalk && new Gitalk({
clientID: '<%= theme.comment.gitalk.client_id %>',
clientSecret: '<%= theme.comment.gitalk.client_secret %>',
repo: '<%= theme.comment.gitalk.repository %>',
owner: '<%= theme.comment.gitalk.github_id %>',
admin: <% if (theme.comment.gitalk.github_admins) { %><%= theme.comment.gitalk.github_admins %><% } else { %>['<%= theme.comment.gitalk.github_id %>']<% } %>,
clientID: '<%= client_id %>',
clientSecret: '<%= client_secret %>',
repo: '<%= repository %>',
owner: '<%= github_id %>',
admin: '<%= github_admins || [github_id] %>',
id: __gitalk__pathname,
language: '<%= config.language %>'
}).render('gitalk-container');