feat: 首页由 navigation 首项决定

- 移除 navigation.active 配置项,默认页以 navigation[0] 为准(生成端/前端一致)
- 注入 homePageId;首页渲染用 profile.title/profile.subtitle 覆盖 title/subtitle
- 模板按 homePageId 切换首页/非首页标题 DOM 与 data-editable,避免样式错位
- 更新默认配置与文档;书签导入不再写入 active 字段
- 新增/更新单测覆盖首页规则与 profile 覆盖

BREAKING CHANGE: 不再支持 navigation[].active;通过调整 navigation 顺序设置默认页/首页
This commit is contained in:
rbetree
2025-12-26 11:04:40 +08:00
parent 9929358d56
commit 704e895773
12 changed files with 173 additions and 35 deletions

View File

@@ -121,7 +121,7 @@ MeNav 配置系统采用“完全替换”策略(不合并),按以下优
5. **导航**
- `navigation[]`:页面入口列表,`id` 需唯一,并与 `pages/` 中配置文件名对应(例如 `id: home` 对应 `pages/home.yml`
- 只允许一个导航项 `active: true` 作为默认页
- 默认首页由 `navigation` 数组顺序决定:**第一项即为首页(默认打开页)**,不再使用 `active` 字段
- 图标使用 Font Awesome 类名字符串(例如 `fas fa-home``fab fa-github`
- 导航显示顺序与数组顺序一致,可通过调整数组顺序改变导航顺序
@@ -230,7 +230,6 @@ navigation:
- name: "首页"
icon: "fas fa-home"
id: "home"
active: true
- name: "项目"
icon: "fas fa-project-diagram"
id: "projects"

View File

@@ -50,12 +50,11 @@ social:
url: https://steam.com
icon: fab fa-steam
# 导航配置
# 导航配置(顺序第一项即首页/默认打开页)
navigation:
- name: 首页 # 菜单名称
icon: fas fa-home # Font Awesome 图标类
id: home # 页面标识符(唯一,需与 pages/home.yml 对应)
active: true # 是否默认激活(全局仅一个 true
- name: 常用 # 菜单名称
icon: fas fa-star # Font Awesome 图标类
id: home # 页面标识符(唯一,需与 pages/<id>.yml 对应)
- name: 项目
icon: fas fa-project-diagram
id: projects