edward852 / blog-skeleton-v3

The skeleton of my personal blog
https://edward852.github.io
1 stars 0 forks source link

post/hugo%E6%B7%BB%E5%8A%A0algolia%E6%90%9C%E7%B4%A2%E6%94%AF%E6%8C%81/ #2

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

Hugo添加Algolia搜索支持 - 时聆心语

本文主要介绍如何在 Hugo 中添加 Algolia 搜索支持。 主要以 Even主题 为例进行说明,不过理论上只需要小的调整即可适用于其他主题。

https://edward852.github.io/post/hugo%E6%B7%BB%E5%8A%A0algolia%E6%90%9C%E7%B4%A2%E6%94%AF%E6%8C%81/

edward852 commented 4 years ago

看起来是拉取algolia索引内容为空引起的,先试下文中"手动上传"那个步骤是否OK?

binhaifgs1 commented 4 years ago

大佬,我用的maupassant主题,本身有站内搜索但是只能搜标题,换成google 搜索别人用着不方便。我想增加这个algolia,没有找到scripts文件,这样js文件引入到哪里,搜索框入口在哪里添加。麻烦指点一下,感谢。

edward852 commented 4 years ago

@binhaifgs1 你用的主题放在 layouts/partials/footer.html 应该就可以了。

binhaifgs1 commented 4 years ago

感谢大佬,我试试

hoasxyz commented 4 years ago

很有帮助,谢谢!

Mark-xing commented 4 years ago

如果想搜索博客的内容,查到这个文章,怎么生成json文件呢

edward852 commented 4 years ago

@Mark-xing "content"那里可以使用变量 .Plain 。不过免费版的algolia每条记录有大小限制,所以文章不能太长,除非升级付费版或者换其他方法。

AGou-ops commented 3 years ago

博主你好,移动端该如何配置?

tiantian-chen commented 3 years ago

怎么运行hugo生成json呢

edward852 commented 3 years ago

@tiantian-chen 直接运行就可以了,不用带参数:hugo

edward852 commented 3 years ago

@AGou-ops 移动端主要修改assets/sass/_partial/_slideout.scss, layouts/partials/slideout.html,详见"适配移动端"小节的说明。

edward852 commented 3 years ago

@qyyd5g 可能是js加的地方不对,导致博文页面没加载。 摘要看这里的说明,我是用<!--more-->控制的。

yinoob commented 2 years ago

博主你好,我按照你的教程操作下来,搜索结果有了但会被下面的文章覆盖掉,能帮我看下还要改动哪个文件吗?

yinoob commented 2 years ago

对了我用的是tale-hugo主题

edward852 commented 2 years ago

@yinoob 具体还是要用浏览器的开发者工具调试,关注css中overflow, z-index属性的情况。我觉得可以先在浏览器尝试给.nav的css class添加z-index属性,有效的话再在 assets/scss/tale/_layout.scss 文件里面修改。

yinoob commented 2 years ago

@edward852 感谢博主!博主牛逼!

Nemo137-Liang commented 1 year ago

博主你好,有个问题想请教,我执行npm init后再执行下一步install命令时会报错,提示为name can only contain URL-friendly characters……求解!

Nemo137-Liang commented 1 year ago

再次打扰,前述的问题我已通过npm install的命令解决,algolia上已有了索引。前端也配置好了,但却没有显示搜索结果,我排查了css均没有overflow的相关属性,想请问博主是否有排查与解决的建议呢?

edward852 commented 1 year ago

@Nemo137-Liang algolia好像也要科学上网才能访问了,不知道有没有关系。

Nemo137-Liang commented 1 year ago

@edward852 我电脑是一直挂着魔法的,所以应该可以排除它的原因

edward852 commented 1 year ago

@Nemo137-Liang 可以参考上面评论说的 z-index 属性,调整看看。