fi3ework / hexo-theme-archer

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

Algolia站内搜索没有显示 #306

Closed lzwgiter closed 2 years ago

lzwgiter commented 2 years ago

「描述遇到的问题」或「发现的 bug」(Describe the problem or bug you encounter) 最新版本Archer主题,博客根目录下_config.yml已填写algolia api key等信息,并通过了hexo aloglia确保无误,主题_config.yml也开启了aloglia选项,但是网页上并没有看到站内搜索栏 你是否已经阅读过以下内容,并确认你的行为是正确的,在 [ ] 中填入 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://float311.gitee.io/

如果可能是与 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)

信息 (please complete the following information):

其他信息(Additional context)

LolipopJ commented 2 years ago

目前版本的 Algolia 搜索按钮在侧边栏中。

考虑到使用上的便利性,未来可能会放置到 \<header \/> 处。

lzwgiter commented 2 years ago

您好!我archer老粉,今天刚刚换了最新1.6.3的版本,然后发现在本地生成的时候hexo -g,会出现打印很多行SEO_Keywords的情况,如果我没有写这些Keywords的话则会打印很多空白行。问题图如下,但之前版本没有出现这个问题。

------------------ 原始邮件 ------------------ 发件人: "fi3ework/hexo-theme-archer" @.>; 发送时间: 2021年8月7日(星期六) 晚上6:15 @.>; @.**@*.**@*.***>; 主题: Re: [fi3ework/hexo-theme-archer] Algolia站内搜索没有显示 (#306)

Reopened #306.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

LolipopJ commented 2 years ago

注意到您博客打印了 console 如下:

jquery.min.js:2 Uncaught ReferenceError: algolia is not defined
    at HTMLDocument.<anonymous> (search.js:15)
    at e (jquery.min.js:2)
    at t (jquery.min.js:2)

但是在网页的源文件里又顺利渲染出了:

<script>
  var hits = JSON.parse('{"per_page":10}')
  var labels = JSON.parse('{"input_placeholder":"Search for Posts","hits_empty":"We did not find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}')

  var algolia = {
    applicationID: '99K726IL0C',
    apiKey: '3afc6cf29d67683d23d7b0faccb5c7ab',
    indexName: 'float's blog',
    hits: hits,
    labels: labels
  }
</script>

我不确定是哪一个地方出了错误。测试我的博客在 Edge 和 Chrome 浏览器能顺利显示 Algolia 搜索功能。


您好!我archer老粉,今天刚刚换了最新1.6.3的版本,然后发现在本地生成的时候hexo -g,会出现打印很多行SEO_Keywords的情况,如果我没有写这些Keywords的话则会打印很多空白行。问题图如下,但之前版本没有出现这个问题。

Ops,图片没有顺利显示在 Github。

不知道您之前用的什么版本呢?考虑到最近有很多代码上的改动,如果是使用手动处理冲突的方式不知道会不会产生错误。

如果可以的话,可以提供一下您的 Archer 主题的 _config.yml 文件,可以帮助我们更好排查错误!

lzwgiter commented 2 years ago

注意到您博客打印了 console 如下:

jquery.min.js:2 Uncaught ReferenceError: algolia is not defined
    at HTMLDocument.<anonymous> (search.js:15)
    at e (jquery.min.js:2)
    at t (jquery.min.js:2)

但是在网页的源文件里又顺利渲染出了:

<script>
  var hits = JSON.parse('{"per_page":10}')
  var labels = JSON.parse('{"input_placeholder":"Search for Posts","hits_empty":"We did not find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}')

  var algolia = {
    applicationID: '99K726IL0C',
    apiKey: '3afc6cf29d67683d23d7b0faccb5c7ab',
    indexName: 'float's blog',
    hits: hits,
    labels: labels
  }
</script>

我不确定是哪一个地方出了错误。测试我的博客在 Edge 和 Chrome 浏览器能顺利显示 Algolia 搜索功能。

您好!我archer老粉,今天刚刚换了最新1.6.3的版本,然后发现在本地生成的时候hexo -g,会出现打印很多行SEO_Keywords的情况,如果我没有写这些Keywords的话则会打印很多空白行。问题图如下,但之前版本没有出现这个问题。

Ops,图片没有顺利显示在 Github。

不知道您之前用的什么版本呢?考虑到最近有很多代码上的改动,如果是使用手动处理冲突的方式不知道会不会产生错误。

如果可以的话,可以提供一下您的 Archer 主题的 _config.yml 文件,可以帮助我们更好排查错误!

我的主题_config.yml文件如下: _config.txt

lzwgiter commented 2 years ago

您好!我archer老粉,今天刚刚换了最新1.6.3的版本,然后发现在本地生成的时候hexo -g,会出现打印很多行SEO_Keywords的情况,如果我没有写这些Keywords的话则会打印很多空白行。问题图如下,但之前版本没有出现这个问题。 ------------------ 原始邮件 ------------------ 发件人: "fi3ework/hexo-theme-archer" @.>; 发送时间: 2021年8月7日(星期六) 晚上6:15 @.>; @.**@*.**@*.***>; 主题: Re: [fi3ework/hexo-theme-archer] Algolia站内搜索没有显示 (#306) Reopened #306. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

问题图片如下,我不知这是否是正常现象 1 image

LolipopJ commented 2 years ago

问题图片如下,我不知这是否是正常现象

看上去是某次提交时为 base-head.ejs 文件添加了一个 console 输出:

<!-- keywords -->
<% var keywords = "" %>
<% var keywordsArr = [page.keywords, theme.SEO_keywords] %>
<% var keywords = keywordsArr.filter(function(item){ return item }).join(',') %>
<% console.log(keywords) %>

毫不影响任何功能,但这句语句本身是没有必要的,我将去掉它。

lzwgiter commented 2 years ago

问题图片如下,我不知这是否是正常现象

看上去是某次提交时为 base-head.ejs 文件添加了一个 console 输出:

<!-- keywords -->
<% var keywords = "" %>
<% var keywordsArr = [page.keywords, theme.SEO_keywords] %>
<% var keywords = keywordsArr.filter(function(item){ return item }).join(',') %>
<% console.log(keywords) %>

毫不影响任何功能,但这句语句本身是没有必要的,我将去掉它。

看来是这样的,我测试没有问题了

LolipopJ commented 2 years ago

现在您的博客一切功能正常了!


刚刚浏览您博客发现 Archer 主题对原文链接处的中文分词处理并不好。这可以为其中的 \<a \/> 标签添加 word-break: break-all; 解决。

或者也可以尝试食用 Archer 主题的 dev 分支,刚刚我修复了这个问题。我将关闭此 Issue.🥳

lzwgiter commented 2 years ago

现在您的博客一切功能正常了!

刚刚浏览您博客发现 Archer 主题对原文链接处的中文分词处理并不好。这可以为其中的 标签添加 word-break: break-all; 解决。

或者也可以尝试食用 Archer 主题的 dev 分支,刚刚我修复了这个问题。我将关闭此 Issue.🥳

好的!多谢您的帮助,祝愿Archer越来越好