hexo-theme-stellar/layout/_partial/plugins/comments/utterances/layout.ejs

27 lines
681 B
Plaintext

<%
function layoutDiv() {
var el = '';
el += '<div id="utterances"';
let utterances = Object.assign({}, theme.comments.utterances, page.utterances);
if (page.comment_id) {
utterances['issue-term'] = page.comment_id;
}
if (page.dark && utterances.theme.dark) {
utterances.theme = utterances.theme.dark;
} else if (utterances.theme.light) {
utterances.theme = utterances.theme.light;
}
if (utterances['issue-number']) {
utterances['issue-term'] = null;
}
for (let key of Object.keys(utterances)) {
if (utterances[key]) {
el += ' ' + key + '="' + utterances[key] + '"';
}
}
el += '></div>';
return el;
}
%>
<%- layoutDiv() %>