fix: restyle pager chips and restore theme ad slots
Build and Deploy / verify (push) Successful in 37s
Build and Deploy / deploy (push) Successful in 38s

Replace the loose page-count label with a SaBlog-style 6 / 316 chip, wire inject/stylevar HTML into list and post views, and flush page cache when ads are saved.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gouki
2026-09-18 21:48:24 +00:00
co-authored by Cursor
parent ae47447062
commit 36c4ffc5b4
41 changed files with 936 additions and 81 deletions
+41 -29
View File
@@ -23,7 +23,18 @@ themes/{name}/
"description": "主题描述",
"author": "作者",
"screenshot": "screenshot.png",
"inject_points": ["head", "header", "sidebar_top", "sidebar_bottom", "content_top", "content_bottom", "post_content_top", "post_content_bottom", "footer", "body_end"]
"inject_points": [
"head",
"header",
"sidebar_top",
"sidebar_bottom",
"content_top",
"content_bottom",
"post_content_top",
"post_content_bottom",
"footer",
"body_end"
]
}
```
@@ -69,21 +80,21 @@ themes/{name}/
## 页面视图清单(控制器会传的数据)
| 视图 | 控制器 | 变量 |
|------|--------|------|
| `index` | HomeController | `$posts`(分页) |
| `show` | PostController | `$post, $comments, $contentHtml` |
| `list` | Category/Archive | `$posts, $category? / $archiveTitle?` |
| `archives` | ArchiveController | `$archives` |
| `tags` | TagController | `$tags` |
| `tag` | TagController | `$tag, $posts` |
| `search` | SearchController | `$posts, $keyword` |
| `links` | LinkController | `$links` |
| `comments` | CommentController | `$comments` |
| `login` / `register` / `profile` | AuthController | — |
| `membership.index` / `membership.mine` | 会员插件 | `$plans / $subscriptions` |
| `membership.paywall` / `membership.paid-teaser` | 会员插件(付费墙) | `$post` |
| `payments.sandbox` / `payments.result` | 支付插件 | `$payment` |
| 视图 | 控制器 | 变量 |
| ----------------------------------------------- | ------------------ | ------------------------------------- |
| `index` | HomeController | `$posts`(分页) |
| `show` | PostController | `$post, $comments, $contentHtml` |
| `list` | Category/Archive | `$posts, $category? / $archiveTitle?` |
| `archives` | ArchiveController | `$archives` |
| `tags` | TagController | `$tags` |
| `tag` | TagController | `$tag, $posts` |
| `search` | SearchController | `$posts, $keyword` |
| `links` | LinkController | `$links` |
| `comments` | CommentController | `$comments` |
| `login` / `register` / `profile` | AuthController | — |
| `membership.index` / `membership.mine` | 会员插件 | `$plans / $subscriptions` |
| `membership.paywall` / `membership.paid-teaser` | 会员插件(付费墙) | `$post` |
| `payments.sandbox` / `payments.result` | 支付插件 | `$payment` |
## 付费墙(paywall)覆盖
@@ -115,25 +126,26 @@ themes/{name}/
主题视图内置 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>` 前 | 统计代码 |
| 注入点 | 位置 | 典型用途 |
| --------------------------- | ------------ | -------------------- |
| `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')` 才能接收注入。
新主题须在对应 partial/视图放置 `@include('partials.theme-inject', ['point' => 'xxx'])`(或 `@stack('theme:xxx')`)才能接收注入。主题变量里的 `ad_header` 等会自动打到对应位置,未映射且含 HTML 的变量落在页脚。保存「主题注入」会清前台整页缓存。
**声明注入点**:`theme.json` 的 `inject_points` 声明主题实现了哪些注入点(缺省视为全部支持),后台主题卡片会展示,切换主题时一目了然。