mohuishou / blogComment

mohuishou's blog comment
0 stars 0 forks source link

post/add-catefories-sidebar-in-blog #271

Closed utterances-bot closed 1 year ago

utterances-bot commented 2 years ago

给博客添加章节目录 - Mohuishou

已经好几个读者朋友咨询过博客左侧的章节导航栏是怎么来的了,挤了点时间,整理了一下之前写的代码,现在大家可以直接使用了

https://lailin.xyz/post/add-catefories-sidebar-in-blog.html

bianchenghou commented 2 years ago

(1)分类结构 /////////////////////////////////////////////////

(3)报错如下////////////////////////////////////////////

WARN [Fluid] It is recommended that you use override configuration: https://hexo.fluid-dev.com/docs/en/guide/#override-configuration INFO Files loaded in 1.09 s INFO Deleted: categories/训练营/Go进阶训练营/Week01-Go错误处理/index.html INFO Deleted: categories/训练营/Go进阶训练营/Week02-Go错误处理/index.html INFO Deleted: categories/训练营/Go进阶训练营/index.html ERROR TypeError: F:\2-GithubWeb\blog_fluid\themes\hexo-theme-fluid\layout\post.ejs:13 11|

12| <% if(page.show_category){ %>

13| <%- partial('_partial/post-categories') %> 14| <% } %> 15|

16|

F:\2-GithubWeb\blog_fluid\themes\hexo-theme-fluid\layout_partial\post-categories.ejs:1

1| <% 2| var cat = page.categories.data.find(c => !c.parent) 3| var a = page.categories.data.filter(c => c.parent == cat._id) 4| // console.log(Object.keys(a[0].posts.data[0]), a[0].posts.data[0].date)

Cannot read property 'Go进阶训练营' of undefined

bianchenghou commented 2 years ago

想请教一下一个问题:

问题描述:文章的yaml中使用一级分类不会报错,使用二级分类会报错(报错如上)

原因:请问是不支持二级目录吗?或是是我二级目录配置方式不对,还是文章的yaml配置方式不对

mohuishou commented 2 years ago

主题配置呢,还有上面的示例包裹在代码块里面会比较好分析

bianchenghou commented 2 years ago

如果站长看到的话,能帮我分析一下原因吗? 非常感谢(^_^)

mohuishou commented 2 years ago

你下载的主题是 develop 分支的么?

mohuishou commented 2 years ago

看报错你是用了 master 分支的代码,请用 develop 分支的哈,master 分支是我之前自用的,无法复用

bianchenghou commented 2 years ago

好哒,非常感谢

phh95 commented 2 years ago

你好,我的博客用的也是 Fluid 主题,如果想要和你一样给博客添加章节目录,是只需要 配置开启章节显示 就好了吗?

mohuishou commented 2 years ago

你好,我的博客用的也是 Fluid 主题,如果想要和你一样给博客添加章节目录,是只需要 配置开启章节显示 就好了吗?

按照教程来应该就能用了

CodeFish-xiao commented 2 years ago

我看了一下主题已经合并了你的pr,但是配置文件修改没生效。。