From 1f3f2f471bd5826a71025d8ea20fc31e51aab45a Mon Sep 17 00:00:00 2001 From: pai233 Date: Thu, 12 May 2022 08:39:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Remark42=E8=AF=84=E8=AE=BA=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=98=BE=E7=A4=BA=E6=96=87=E7=AB=A0=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/header/post-info.pug | 6 +++++- layout/includes/mixins/post-ui.pug | 4 ++++ .../third-party/card-post-count/index.pug | 4 +++- .../third-party/card-post-count/remark42.pug | 21 +++++++++++++++++++ .../third-party/comments/remark42.pug | 2 +- 5 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 layout/includes/third-party/card-post-count/remark42.pug diff --git a/layout/includes/header/post-info.pug b/layout/includes/header/post-info.pug index 3293697..6993123 100644 --- a/layout/includes/header/post-info.pug +++ b/layout/includes/header/post-info.pug @@ -116,4 +116,8 @@ when 'Facebook Comments' +countBlock a(href=url_for(page.path) + '#post-comment') - span.fb-comments-count(data-href=urlNoIndex()) \ No newline at end of file + span.fb-comments-count(data-href=urlNoIndex()) + when 'Remark42' + +countBlock + a(href=url_for(page.path) + '#post-comment') + span(class="remark42__counter" data-url=urlNoIndex()) \ No newline at end of file diff --git a/layout/includes/mixins/post-ui.pug b/layout/includes/mixins/post-ui.pug index d2cb014..d3bf406 100644 --- a/layout/includes/mixins/post-ui.pug +++ b/layout/includes/mixins/post-ui.pug @@ -88,6 +88,10 @@ mixin postUI(posts) +countBlockInIndex a(href=url_for(link) + '#post-comment') span.fb-comments-count(data-href=urlNoIndex(article.permalink)) + when 'Remark42' + +countBlockInIndex + a(href=url_for(link) + '#post-comment') + span(class="remark42__counter" data-url=urlNoIndex(article.permalink)) //- Display the article introduction on homepage case theme.index_post_content.method diff --git a/layout/includes/third-party/card-post-count/index.pug b/layout/includes/third-party/card-post-count/index.pug index 44839b3..195d9ec 100644 --- a/layout/includes/third-party/card-post-count/index.pug +++ b/layout/includes/third-party/card-post-count/index.pug @@ -9,4 +9,6 @@ case theme.comments.use[0] when 'Waline' include ./waline.pug when 'Facebook Comments' - include ./fb.pug \ No newline at end of file + include ./fb.pug + when 'Remark42' + include ./remark42.pug \ No newline at end of file diff --git a/layout/includes/third-party/card-post-count/remark42.pug b/layout/includes/third-party/card-post-count/remark42.pug new file mode 100644 index 0000000..7de001b --- /dev/null +++ b/layout/includes/third-party/card-post-count/remark42.pug @@ -0,0 +1,21 @@ +- const { host, siteId, language, option } = theme.remark42 + +script. + let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light' + var remark_config = Object.assign({ + host: '!{host}', + site_id: '!{siteId}', + components: ['counter'] + },!{JSON.stringify(option)}) + +script. + function loadRemark42(){ + !function(e,r){ + for(var o=r.head||r.body,n=0;n