style(gitalk): gitalk.ejs code optimization
This commit is contained in:
parent
f316f865cd
commit
2d80c45ec5
|
@ -1,9 +1,11 @@
|
||||||
|
<% const { client_id, client_secret, repository, github_id, github_admins } = theme.comment.gitalk %>
|
||||||
|
|
||||||
<% if(
|
<% if(
|
||||||
theme.comment.use === 'gitalk'
|
theme.comment.use === 'gitalk'
|
||||||
&& theme.comment.gitalk.client_id
|
&& client_id
|
||||||
&& theme.comment.gitalk.client_secret
|
&& client_secret
|
||||||
&& theme.comment.gitalk.github_id
|
&& github_id
|
||||||
&& theme.comment.gitalk.repository
|
&& repository
|
||||||
) { %>
|
) { %>
|
||||||
<div id="gitalk-container"></div>
|
<div id="gitalk-container"></div>
|
||||||
<script <%= theme.pjax.enable === true ? 'data-pjax' : '' %>
|
<script <%= theme.pjax.enable === true ? 'data-pjax' : '' %>
|
||||||
|
@ -19,12 +21,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Gitalk && new Gitalk({
|
Gitalk && new Gitalk({
|
||||||
clientID: '<%= theme.comment.gitalk.client_id %>',
|
clientID: '<%= client_id %>',
|
||||||
clientSecret: '<%= theme.comment.gitalk.client_secret %>',
|
clientSecret: '<%= client_secret %>',
|
||||||
repo: '<%= theme.comment.gitalk.repository %>',
|
repo: '<%= repository %>',
|
||||||
owner: '<%= theme.comment.gitalk.github_id %>',
|
owner: '<%= github_id %>',
|
||||||
admin: <% if (theme.comment.gitalk.github_admins) { %><%= theme.comment.gitalk.github_admins %><% } else { %>['<%= theme.comment.gitalk.github_id %>']<% } %>,
|
admin: '<%= github_admins || [github_id] %>',
|
||||||
id: __gitalk__pathname,
|
id: __gitalk__pathname,
|
||||||
language: '<%= config.language %>'
|
language: '<%= config.language %>'
|
||||||
}).render('gitalk-container');
|
}).render('gitalk-container');
|
||||||
|
|
Loading…
Reference in New Issue