feat: 主题内容注入点系统(10 个标准位置,同位置多条注入块可排序/启停,stylevar 变量复活)+ 后台主题注入管理页(Tab 分区)+ 缓存/设置收进顶部用户下拉菜单(Livewire action 即时通知)

This commit is contained in:
ak
2026-08-11 23:20:57 +08:00
parent e91675e172
commit 3e3b9a2bfd
98 changed files with 485 additions and 105 deletions
+24
View File
@@ -100,6 +100,30 @@ themes/{name}/
- 开发期:`GET /themes/{name}/assets/{path}` 流式返回(带缓存头)
- 生产:`php artisan theme:publish` 复制到 `public/themes/`,由 Web 服务器托管
## 内容注入点(广告 / 统计 / 临时链接)
主题视图内置 10 个注入点(Blade `@stack`),后台「主题注入」页管理:
| 注入点 | 位置 | 典型用途 |
|--------|------|----------|
| `theme:head` | `</head>` 前 | 统计代码、广告、验证 |
| `theme:header` | 页头下方 | 顶部横幅/公告 |
| `theme:sidebar_top` | 侧边栏顶部 | 首屏广告 |
| `theme:sidebar_bottom` | 侧边栏底部 | 广告/临时链接 |
| `theme:content_top` | 内容区顶部 | 列表/文章上方横幅 |
| `theme:content_bottom` | 内容区底部 | 分页后广告 |
| `theme:post_content_top` | 文章正文前 | 正文顶部广告 |
| `theme:post_content_bottom` | 文章正文后 | 正文底部广告 |
| `theme:footer` | 页脚前 | 版权上方声明 |
| `theme:body_end` | `</body>` 前 | 统计代码 |
特性:
- **同一位置可添加多条**注入块(名称 + HTML + 排序 + 启停),按排序渲染
- 插件可通过 filter `theme.inject.{point}` 追加
- 主题变量(stylevar 复活):后台「主题注入」→「主题变量」Tab,视图用 `{{ theme('var', 'key') }}` 引用任意 HTML
新主题须在对应 partial/视图放置 `@stack('theme:xxx')` 才能接收注入。
## 预览图
`theme.json``screenshot` 指向 `assets/` 下的预览图(如 `screenshot.png`),后台主题管理以卡片形式展示。可用无头浏览器截图生成:`node` + playwright 打开站点首页保存为 `themes/{name}/assets/screenshot.png`