-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于hexo博客单篇文章初始化两次的问题 #68
Comments
#46 |
@GeekaholicLin 问题提了很多次,然而还是没有彻底解决 |
“标示符会自动生成带 #more的url” “导致一篇文章初始化了两次” |
@GeekaholicLin 請問在你的主題裏面,gitment 配置中的 id 要在哪一個檔案修改呢?我用了你最新的 theme 還是會發生重複初始化的狀況 |
@mosdeo 在gitment.swig这个文件里。 |
今天遇到了同样的问题,@GeekaholicLin 所说的方法能搞定绝大部分情况。 我的最开始解决方案是这样的。 后来就索性直接删除最后的
如果之前文章的评论不重要,或者刚刚准备配置使用 GItment 的,我认为用这种比较合适。 |
@isecret 我在使用 // themes/material/layout/_widget/comment/gitcomment/enter.ejs
<script>
var gitment = new Gitment({
id: <%= theme.comment.gitment_post_id %>, // 可选。默认为 location.href
// some other settings
})
gitment.render('container')
</script> 配置文件: // themes/material/_config.yml
comment:
# useable settings
# gitment_post_id: window.location.pathname
# this will break!
gitment_post_id: window.location.pathname.replace(/(\/$)/g, '')
# other configs 如果像上面配置的话, ejs会无法识别replace而失效, 请问有什么解决方案吗? |
@huangjj27 你试试这样。脑洞解析,没测试过。 <script>
var gitment = new Gitment({
id: <%= theme.comment.gitment_post_id %>.replace(/(\/$)/g, ''), // 可选。默认为 location.href
// some other settings
})
gitment.render('container')
</script> 不行的话直接粗暴点,写在 script 标签里吧。 <script>
var gitment = new Gitment({
id: window.location.pathname.replace(/(\/$)/g, ''), // 可选。默认为 location.href
// some other settings
})
gitment.render('container')
</script> |
@isecret 那就不折腾了, 目前用得还可以 |
噶阿三 |
文章 标示符会自动生成带 #more的url,导致一篇文章初始化了两次,有没有好的解决办法呢?
The text was updated successfully, but these errors were encountered: