# 主题(皮肤)开发指南 ## 目录结构 ``` themes/{name}/ ├── theme.json # 主题清单(必填) ├── views/ # Blade 视图(激活后前置到全局视图路径) │ ├── partials/ # head / header / sidebar / footer 等公共片段 │ ├── index.blade.php │ ├── show.blade.php │ ├── list.blade.php │ └── ... # 缺省视图自动回退默认主题(resources/views/) └── assets/ # CSS / JS / 图片(/themes/{name}/assets/... 访问) ``` ## theme.json ```json { "title": "主题标题", "version": "1.0.0", "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"] } ``` ## 视图解析规则 1. 激活主题的 `views/` 目录被**前置到全局视图路径** 2. 页面视图用 `@include('partials.header')` 等**按名字解析** → 主题有同名 partial 就用主题的,否则用默认主题的 3. 页面视图同理:主题提供 `index.blade.php` 则覆盖默认首页,否则用 `resources/views/index.blade.php` 所以做一个新皮肤通常只需要:`theme.json` + `assets/style.css` + 覆盖 `partials/`(head/header/sidebar/footer)+ 需要特别定制的页面视图。 ## 布局结构(约定) ### 默认主题(resources/views/) ```blade @include('partials.head') {{--
含 SEO meta --}} @include('partials.header') {{-- 站点头 --}}