Candinya / Kratos-Rebirth

一个可爱而现代的 Hexo 主题
GNU General Public License v3.0
630 stars 80 forks source link

新功能建议: 简化 _config.yml 并使用 _config.kratos-rebirth.yml 存放推荐设置 #131

Closed ghost closed 2 years ago

ghost commented 2 years ago
  1. 您的新功能建议是由使用时出现的不便引发的吗? [Y]

根据 Hexo文档 , hexo 的站点配置文件 , 主题手动配置文件和主题自带配置文件是进行合并的。

Hexo 在合并主题配置时,Hexo 配置文件中的 theme_config 的优先级最高,其次是 _config.[theme].yml 文件,最后是位于主题目录下的 _config.yml 文件。

这导致用户实际想(通过删除主题手动配置文件中的对应项)删除的设置被主题自带配置文件覆盖, 从而显示默认配置文件的效果.

举例: Top Menu 顶部导航栏配置

用户只修改了 `site_folder/_config.kratos-rebirth.yml` : ``` menu: index: / archives: /archives/ sites: submenu: true Vercel: https://vercel.app 4everland: https://4everland.app label: index: Home archives: Posts sites: submenu: Alternative Vercel: Vercel 4everland: 4everland ``` 主题自带配置文件 `site_folder/node_modules/hexo-theme-kratos-rebirth/_config.yml` 未进行修改: ``` menu: index: / archives: /archives/ friends: /friends/ sites: submenu: true author: https://candinya.com project: https://github.com/Candinya/Kratos-Rebirth label: index: 首页 archives: 档案馆 friends: 好伙伴 sites: submenu: 链接 author: 作者博客 project: 项目链接 ``` 渲染时仍产生推荐配置中的 `好伙伴` `作者博客` `项目链接` 等菜单链接, 意味着对应的 `friends` 等项被合并了而没有如预期一样被删除. ![图片](https://user-images.githubusercontent.com/103689666/172057654-a8de41c8-8399-485b-abca-18f84a5cd228.png)

  1. 请描述您所设想的功能或是解决方案

在主题模块的 _config.yml 中只进行基础设置, 将推荐设置放在 _config.kratos-rebirth.yml 中, 并引导用户直接复制 _config.kratos-rebirth.yml 进行修改.

  1. 补充内容:

一个无关主题的问题: hexo-blog-encrypt 模块中涉及 文章TOC加密 的部分主题是否已经适配? 若没有, 我想请教下对应 <%- post.content %> 的代码位于哪里?

Candinya commented 2 years ago

有道理,其实这算是一个 bug

Candinya commented 2 years ago

文章TOC加密 不确认是否可用(按理来说应该没问题,但不保证是否可能有需要针对兼容进行特殊调整的地方),<%- post.content %>https://github.com/Candinya/Kratos-Rebirth/blob/master/layout/post.ejs#L52 这里

ghost commented 2 years ago

文章TOC加密 不确认是否可用(按理来说应该没问题,但不保证是否可能有需要针对兼容进行特殊调整的地方),<%- post.content %>https://github.com/Candinya/Kratos-Rebirth/blob/master/layout/post.ejs#L52 这里

感谢回复, 稍后修改验证下. 下午折腾 Hexo Injector 要半疯掉hhh 就是#130那个

ArcticLampyrid commented 2 years ago

一个无关主题的问题: hexo-blog-encrypt 模块中涉及 文章TOC加密 的部分主题是否已经适配? 若没有, 我想请教下对应 <%- post.content %> 的代码位于哪里?

hexo-blog-encrypt 会自动完成对 post.content 注入,其基本功能是可用的 但一些细节上的内容,如TOC的渲染,未经过测试

ghost commented 2 years ago

确认#131已解决 图片

关于 hexo-blog-encrypt 的问题我之后再debug一下吧, 和别的主题一样的现象: 加密文章不显示toc

辛苦二位 晚安(x