2021-02-21 23:20:13 +08:00
|
|
|
<%
|
|
|
|
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;
|
|
|
|
}
|
2021-02-22 22:03:02 +08:00
|
|
|
if (utterances['issue-number']) {
|
|
|
|
utterances['issue-term'] = null;
|
|
|
|
}
|
2021-02-21 23:20:13 +08:00
|
|
|
for (let key of Object.keys(utterances)) {
|
|
|
|
if (utterances[key]) {
|
|
|
|
el += ' ' + key + '="' + utterances[key] + '"';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
el += '></div>';
|
|
|
|
return el;
|
|
|
|
}
|
|
|
|
%>
|
|
|
|
<%- layoutDiv() %>
|