mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
feat: Remark42评论支持显示文章评论数
This commit is contained in:
@@ -116,4 +116,8 @@
|
|||||||
when 'Facebook Comments'
|
when 'Facebook Comments'
|
||||||
+countBlock
|
+countBlock
|
||||||
a(href=url_for(page.path) + '#post-comment')
|
a(href=url_for(page.path) + '#post-comment')
|
||||||
span.fb-comments-count(data-href=urlNoIndex())
|
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())
|
||||||
@@ -88,6 +88,10 @@ mixin postUI(posts)
|
|||||||
+countBlockInIndex
|
+countBlockInIndex
|
||||||
a(href=url_for(link) + '#post-comment')
|
a(href=url_for(link) + '#post-comment')
|
||||||
span.fb-comments-count(data-href=urlNoIndex(article.permalink))
|
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
|
//- Display the article introduction on homepage
|
||||||
case theme.index_post_content.method
|
case theme.index_post_content.method
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ case theme.comments.use[0]
|
|||||||
when 'Waline'
|
when 'Waline'
|
||||||
include ./waline.pug
|
include ./waline.pug
|
||||||
when 'Facebook Comments'
|
when 'Facebook Comments'
|
||||||
include ./fb.pug
|
include ./fb.pug
|
||||||
|
when 'Remark42'
|
||||||
|
include ./remark42.pug
|
||||||
21
layout/includes/third-party/card-post-count/remark42.pug
vendored
Normal file
21
layout/includes/third-party/card-post-count/remark42.pug
vendored
Normal file
@@ -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<e.length;n++){
|
||||||
|
var t=r.createElement("script"),m="noModule"in t,c=m?".mjs":".js";
|
||||||
|
m&&(t.type="module"),t.async=!0,t.defer=!0,t.src=remark_config.host+"/web/"+e[n]+c,o.appendChild(t)
|
||||||
|
}
|
||||||
|
}(remark_config.components||["embed"],document)
|
||||||
|
}
|
||||||
|
|
||||||
|
window.pjax ? loadRemark42() : window.addEventListener('load', loadRemark42)
|
||||||
@@ -4,7 +4,7 @@ script.
|
|||||||
var remark_config = Object.assign({
|
var remark_config = Object.assign({
|
||||||
host: '!{host}',
|
host: '!{host}',
|
||||||
site_id: '!{siteId}',
|
site_id: '!{siteId}',
|
||||||
components: ['embed'],
|
components: ['embed','counter'],
|
||||||
locale: '!{language}',
|
locale: '!{language}',
|
||||||
},!{JSON.stringify(option)})
|
},!{JSON.stringify(option)})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user