Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Jun 5, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Jun 5, 2022

  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: <i class="fa fa-home"></i>Home
  archives: <i class="fa fa-file"></i>Posts
  sites:
    submenu: <i class="fa fa-link"></i>Alternative
    Vercel: <i class="fa fa-vimeo"></i>Vercel
    4everland: <i class="fa fa-laptop"></i>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: <i class="fa fa-home"></i>首页
  archives: <i class="fa fa-file"></i>档案馆
  friends: <i class="fa fa-paw"></i>好伙伴
  sites:
    submenu: <i class="fa fa-link"></i>链接
    author: 作者博客
    project: 项目链接

渲染时仍产生推荐配置中的 好伙伴 作者博客 项目链接 等菜单链接, 意味着对应的 friends 等项被合并了而没有如预期一样被删除.

图片

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

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

  1. 补充内容:

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

@ghost ghost added the enhancement New feature or request label Jun 5, 2022
@ghost ghost assigned Candinya Jun 5, 2022
@Candinya
Copy link
Owner

Candinya commented Jun 5, 2022

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

@Candinya
Copy link
Owner

Candinya commented Jun 5, 2022

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

@ghost
Copy link
Author

ghost commented Jun 5, 2022

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

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

@ArcticLampyrid
Copy link
Collaborator

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

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

@ghost
Copy link
Author

ghost commented Jun 5, 2022

确认#131已解决
图片

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

辛苦二位 晚安(x

@ghost ghost closed this as completed Jun 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants