Files
blog/public/admin/config.yml
T
wait4xandGLM-5.3 7c1462bde0 fix(admin): 书封上传路径修复——media_folder 相对解析 + Astro 暂留 7.3.8
- Sveltia 对 folder 集合的 media_folder 按"相对集合目录"解析:写成
  content/posts/assets 会二次嵌套成 content/posts/content/posts/assets
  (用户在后台首次上传书封即踩,文件落错位置 + cover 引用缺失 →
  构建 ImageNotFound,发布链中断)。修为 assets,并把已落错位置的
  书封文件移到 content/posts/assets/
- Astro 7.4.4 需要 Node >= 22.23.4,宿主为 22.22.3:升级将锁死 CI
  构建(实测 CI 报 not supported)。本笔回落到 7.3.8 恢复发布链;
  Node 升级后另行升级 Astro(含全链验收)

验证: pnpm astro build 44 页 exit 0;书封图片入 content/posts/assets/
      与文章 cover 路径一致

Spec: none (后台路径修复 + 依赖回滚)

Co-authored-by: GLM-5.3
2026-11-02 15:09:03 +08:00

154 lines
7.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# yaml-language-server: $schema=https://unpkg.com/@sveltia/cms/schema/sveltia-cms.json
# Sveltia CMS 配置(T3 试水):仅 photos 集合,见 docs 预研报告
# 纪律:不开内建图片优化(transformations 会把原图转 webp 抹掉 EXIF,构建期提取报废)
backend:
name: gitea
repo: wait4x/blog
branch: main
# 走博客域同源反代(nginx /gitea/ → 127.0.0.1:13020):
# ①绕开 git.wait4x.online 的 ESA 522 ②同源无 CORS ③ESA 缓存规则已排除 /artalk/api
base_url: https://wait4x.online/gitea
api_root: https://wait4x.online/gitea/api/v1
media_folder: content/photos
site_url: https://wait4x.online
output:
# Astro zod optional 兼容:空可选字段不写文件(官方 Astro 指南建议)
omit_empty_optional_fields: true
collections:
# 文章(含书评/技术/照片三轨;书=category:reading 的文章,同一集合管理)
- name: posts
label: 文章
label_singular: 文章
folder: content/posts
create: true
# 中文主稿;英文为 TMT 预翻译入仓的 .en.md(posts-en 集合不在后台,防误改译文)
slug: '{{slug}}'
summary: '{{title}} · {{category}}'
sortable_fields: [pubDate, title]
# 注意:Sveltia 对 folder 集合的 media_folder 按"相对集合目录"解析
# (写成 content/posts/assets 会二次嵌套成 content/posts/content/posts/assets,
# 实测 2026-11-02 首上传即踩),故这里必须写 assets
media_folder: assets
public_folder: ./assets
fields:
- { label: 标题, name: title, widget: string }
- { label: 日期, name: pubDate, widget: datetime, date_format: 'YYYY-MM-DD', time_format: false, format: 'YYYY-MM-DD' }
- { label: 分轨, name: category, widget: select, options: [{label: 阅读, value: reading}, {label: 技术, value: tech}, {label: 照片, value: photo}] }
- { label: 标签, name: tags, widget: list, required: false }
- { label: 情绪色(书评色脊), name: mood, widget: color, required: false, hint: '#RRGGBB,仅阅读轨使用' }
- { label: 原书作者, name: bookAuthor, widget: string, required: false }
- { label: 一句话描述(书架策展语), name: description, widget: text, required: false }
- { label: 书封图, name: cover, widget: image, required: false, hint: '上传后自动生成,无需手填路径;仅阅读轨展示' }
- label: 附视频(可选)
name: video
widget: file
required: false
media_folder: public/media
public_folder: /media
hint: '展示在正文之后;mp4/webm ≤50MB(走 public/media,构建时原样拷贝,不做转码)'
- label: 视频封面(可选)
name: poster
widget: string
required: false
hint: '填 /media/xxx.jpg(先上传到 public/media 取路径);缺省浏览器自取首帧'
- { label: 隐藏(不进列表/sitemap), name: hiddenTag, widget: boolean, required: false, hint: '对应 tags 含 hidden;保存后请人工核对' }
- { label: 草稿, name: draft, widget: boolean, required: false, default: false }
- { label: 正文, name: body, widget: markdown }
# 瞬间:随手发(text/image 至少其一——Sveltia 无法表达条件必填,两者都设可选,
# 保存前自查;pubDate 必填)。图片走图库媒体库(content/photos 同源可复用)
- name: moments
label: 瞬间
folder: content/moments
create: true
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
summary: '{{fields.pubDate}} · {{fields.text}}'
fields:
- { label: 时间, name: pubDate, widget: datetime, date_format: 'YYYY-MM-DD', time_format: false, format: 'YYYY-MM-DD' }
- { label: 文字, name: text, widget: text, required: false, hint: '一句话(与图片至少填一项)' }
- { label: 图片, name: image, widget: image, required: false, hint: '与文字至少填一项;建议先压缩' }
- label: 标签
name: tags
widget: list
required: false
- name: photos
label: 图库照片
folder: content/photos
# 整文件 JSON(非 frontmatter)= 现有 sidecar 同构;不设 format 条目不列出
format: json
create: true
# 入口相对:jpg 与 sidecar 同目录;image 引用写裸文件名(loader new URL 等价解析)
media_folder: ''
public_folder: ''
summary: '{{fields.group}} · {{fields.title}}'
fields:
# title 必填:Astro schema z.string() 无 .optional(),omit 纪律下必需且有值才会落键(空 title 会让 main 不可构建)
- { label: 标题, name: title, widget: string, required: true }
- { label: 图片, name: image, widget: image }
- { label: 分组, name: group, widget: select, options: [street, landscape] }
- { label: 替代文本, name: alt, widget: string, required: false }
- { label: 人为描述, name: caption, widget: text, required: false, hint: 展示在灯箱里的人为描述(一句话策展文案) }
- label: EXIF 覆盖(一般留空,构建期自动从图提取)
name: exif
widget: object
required: false
fields:
- { label: 机身, name: make, widget: string, required: false }
- { label: 镜头, name: lens, widget: string, required: false }
- { label: 光圈值, name: fNumber, widget: number, required: false }
- { label: 曝光秒, name: exposureTime, widget: number, required: false }
- { label: ISO, name: iso, widget: number, required: false }
# 页面文案单例(cms 车道 A):三个文件型入口,保存即写 content/site/*.yaml,
# 字段与 Astro siteHome/siteAbout/siteOpenSource 的 schema 一一对应(zh/en 双字段,留空回落默认)
- name: site_pages
label: 页面文案
files:
- name: home
label: 主页设置
file: content/site/home.yaml
fields:
- label: 身份语
name: tagline
widget: object
fields:
- { label: 中文, name: zh, widget: string, required: false }
- { label: 英文, name: en, widget: string, required: false }
- name: about
label: 关于页
file: content/site/about.yaml
fields:
- label: 身份陈述段
name: intro
widget: object
hint: 渲染在「关于」标题下方、名片之上;留空用默认文案
fields:
- { label: 中文, name: zh, widget: text, required: false }
- { label: 英文, name: en, widget: text, required: false }
- name: opensource
label: 开源页
file: content/site/opensource.yaml
fields:
- label: 叙述(链接前)
name: blurb
widget: object
fields:
- { label: 中文, name: zh, widget: string, required: false }
- { label: 英文, name: en, widget: string, required: false }
- { label: 仓库链接地址, name: repo_url, widget: string, required: false }
- { label: 仓库链接文字, name: repo_label, widget: string, required: false }
- label: 叙述(链接后)
name: blurb_after
widget: object
fields:
- { label: 中文, name: zh, widget: text, required: false }
- { label: 英文, name: en, widget: text, required: false }
- label: 置顶项目(仓库短名,顺序即展示顺序)
name: pinned
widget: list
required: false
hint: '如 blog;留空则回落默认 blog。填写的名字须与仓库短名一致'