blog/themes/fluid/layout/_partials/comments/remark42.ejs
2024-11-16 11:34:10 +08:00

30 lines
975 B
Plaintext

<% if (theme.remark42.host && theme.remark42.site_id) { %>
<div id="remark42"></div>
<script type="text/javascript">
var schema = document.documentElement.getAttribute('data-user-color-scheme');
if (schema !== 'light' && schema !== 'dark') {
schema = 'light';
}
var remark_config = Object.assign(
<%- JSON.stringify(theme.remark42 || {}) %>,
{
url: '<%= url_for(page.path) %>',
page_title: '<%= page.title %>',
theme: schema,
}
);
Fluid.utils.loadComments('#remark42', function() {
(function (c) {
for (var i = 0; i < c.length; i++) {
var d = document, s = d.createElement('script');
s.src = remark_config.host + '/web/' + c[i] + '.js';
s.defer = true;
(d.head || d.body).appendChild(s);
}
})(remark_config.components || ['embed']);
});
</script>
<noscript>Please enable JavaScript to view the comments</noscript>
<% } %>