-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use new api for Artalk v2.5.0+ update #7
Conversation
Signed-off-by: qwqcode <qwqcode@gmail.com>
@@ -13,8 +13,8 @@ artalk: | |||
|
|||
# Frontend resources CDN, you can set this to your preferred CDN | |||
## Reference: https://artalk.js.org/guide/frontend/install.html | |||
jsUrl: https://unpkg.com/artalk@2/dist/Artalk.js | |||
cssUrl: https://unpkg.com/artalk@2/dist/Artalk.css | |||
jsUrl: https://artalk.example.com/dist/Artalk.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后端程序中包含了对应版本的前端资源文件,可保证版本一致性,但同时也推荐使用 CDN 资源加快速度。
@@ -17,15 +16,15 @@ | |||
condition: window.Artalk | |||
})) | |||
.then(() => { | |||
new Artalk(CONFIG.artalk); | |||
Artalk.init(CONFIG.artalk); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
将 new Artalk
创建新实例对象替换为新版提供的函数,防止反复创建实例浪费资源
@@ -1,8 +1,7 @@ | |||
{{ next_data('artalk', config.artalk, { | |||
el: '#comments', | |||
pageKey: url_for(page.path) | replace(r/index\.html$/, ''), | |||
pageTitle: page.title, | |||
locale: page.lang | default('zh-CN', true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
语言可以在侧边栏控制中心修改
useBackendConf: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新版 useBackendConf
已修改为默认开启
@qwqcode 谢谢PR! |
我又发现了点 BUG,将在下一个版本修复 😅 |
最新版 v2.5.2 应该修好了 |
@qwqcode 多谢多谢! |
v2.5.0+ 新版更新了一些新的函数,有助于方便在 Pjax、SPA 的用例中快速集成 Artalk,对性能优化有助于解决内存泄露等问题。
https://artalk.js.org/develop/fe-api.html
但是还没在 hexo 中具体测试过,麻烦帮忙测一测 😁