diff --git a/_config.yml b/_config.yml index c2b0c2a..81a3222 100644 --- a/_config.yml +++ b/_config.yml @@ -362,6 +362,7 @@ remark42: language: en # https://remark42.com/docs/configuration/frontend/#locales showEmailSubscription: true simpleView: false + maxShownComments: 15 # Chat Services # -------------------------------------- diff --git a/layout/includes/third-party/comments/remark42.pug b/layout/includes/third-party/comments/remark42.pug index d6bae0d..e2c8b8c 100644 --- a/layout/includes/third-party/comments/remark42.pug +++ b/layout/includes/third-party/comments/remark42.pug @@ -1,11 +1,13 @@ - const { host, siteId, language } = theme.remark42 script. + let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light' var remark_config = { host: '!{host}', site_id: '!{siteId}', components: ['embed'], locale: '!{language}', show_email_subscription: #{theme.remark42.showEmailSubscription}, + theme: nowTheme, simple_view: #{theme.remark42.simpleView} } @@ -24,6 +26,16 @@ script. })(remark_config.components || ['embed'], document) } + function changeRemark42Theme(){ + let theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark' + window.REMARK42.changeTheme(theme) + } + + let themeBtn = document.getElementById('darkmode') + themeBtn.addEventListener('click',()=>{ + changeRemark42Theme() + }) + if ('!{theme.comments.use[0]}' === 'Remark42' || !!{theme.comments.lazyload}) { if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('remark42'), loadRemark42) else loadRemark42()