breaking changes: waline 適配 V2

breaking changes: waline 的 visitor 改為 pageview
feat: algolia 搜索增加文章內容顯示和高亮
feat: 搜索內容顯示區域變大
This commit is contained in:
Jerry
2022-05-03 18:57:59 +08:00
parent ec78f66470
commit 5b1473c2c8
21 changed files with 248 additions and 335 deletions

View File

@@ -1,5 +1,3 @@
- let { avatar,avatarCDN } = theme.waline
script.
window.addEventListener('load', () => {
const changeContent = (content) => {
@@ -45,11 +43,11 @@ script.
const getComment = () => {
const loadWaline = () => {
Waline.Widget.RecentComments({
Waline.RecentComments({
serverURL: '!{theme.waline.serverURL}',
count: !{theme.newest_comments.limit}
}).then(res => {
const walineArray = res.comments.map(e => {
}).then(({comments}) => {
const walineArray = comments.map(e => {
return {
'content': changeContent(e.comment),
'avatar': e.avatar,
@@ -67,7 +65,7 @@ script.
}
if (typeof Waline === 'function') loadWaline()
else getScript('!{url_for(theme.asset.waline)}').then(loadWaline)
else getScript('!{url_for(theme.asset.waline_js)}').then(loadWaline)
}
const newestCommentInit = () => {