fi3ework / hexo-theme-archer

🎯 A smart and modern theme for Hexo.
https://fi3ework.github.io/hexo-theme-archer
MIT License
1.5k stars 274 forks source link

Algolia 无法使用 #270

Closed SwiftSIQI closed 2 years ago

SwiftSIQI commented 4 years ago

「描述遇到的问题」或「发现的 bug」(Describe the problem or bug you encounter) 升级到最新的 archer 版本后,algolia 点击无反应 chrome 的 console 报错,报错内容如下

Uncaught ReferenceError: algolia is not defined
    at HTMLDocument.<anonymous> (search.js:74)
    at l (jquery.min.js:2)
    at c (jquery.min.js:2)

你是否已经阅读过以下内容,并确认你的行为是正确的,在 [ ] 中填入 x 选中(Ensure that you had consulted followings and confirm the validity of your operation, fill x in [ ] to select)

如何复现(To Reproduce)

正常升级,把最新的文件拷贝到目录下,进行部署后,就能复现

存在问题或 bug 的已部署上线的页面地址(A deployed page link that with bug or problem)

网页地址:https://sketchk.xyz/ 仓库地址:https://github.com/SketchK/SKETCHK-BLOG

如果可能是与 markdown 内容相关的问题或 bug,请粘贴对应的 markdown 内容(If the problem or bug that may be related to markdown, paste it here)

打开控制台,填写控制台中打印的主题的版本,如果脚本出错可直接提供控制台截图(Open the console and report the version of hexo-theme-archer. You can paste the screenshot on console directly if there is error with script)

 🎯 hexo-theme-archer ⬇️ 
main.js:200  🏷 Version: 1.6.1 
main.js:201  📅 Version date: 20180830 
main.js:202  📦 https://github.com/fi3ework/hexo-theme-archer 
main.js:2327 desktop
(index):318 font loaded
(index):1 A cookie associated with a cross-site resource at http://busuanzi.ibruce.info/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
main.js:265 PLACEHOLDER REMOVED
jquery.min.js:2 jQuery.Deferred exception: algolia is not defined ReferenceError: algolia is not defined
    at HTMLDocument.<anonymous> (https://sketchk.xyz/scripts/search.js:74:27)
    at l (https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js:2:29375)
    at c (https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js:2:29677) undefined
w.Deferred.exceptionHook @ jquery.min.js:2
jquery.min.js:2 Uncaught ReferenceError: algolia is not defined
    at HTMLDocument.<anonymous> (search.js:74)
    at l (jquery.min.js:2)
    at c (jquery.min.js:2)
main.js:221 All resources finished loading!
The resource https://at.alicdn.com/t/font_327081_1dta1rlogw17zaor.woff was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.

信息 (please complete the following information):

其他信息(Additional context)

styyt commented 4 years ago

我遇到了同样的问题,有解决方案吗?

912988434 commented 3 years ago

同遇到问题,有啥解决办法么

Endsieg77 commented 3 years ago

我也遇到这问题了

Endsieg77 commented 3 years ago

@styyt @912988434 找到问题了,在/_partial/sidebar下面那个base-head.ejs里面, 把if里面第一个条件换成 theme.algolia_search != undefined 原来的打错字了,导致algolia没被初始化