v.Latest
Documentation
建模你的内容
Tina schema定义了你的内容结构。
Tina使用“内容建模即代码”的方法。
- schema是版本控制的
- 你可以在本地或分支中测试schema的更改。
- 你可以以有趣的方式扩展schema(自定义验证、自定义UI字段等)。
具体来说,TinaCMS配置文件中的schema属性决定了内容存储和编辑器之间的数据映射。
schema.collections数组中的每个项目代表不同的内容结构。
每个项目包含一个fields数组,用于控制TinaCMS编辑器中显示的内容。
// tina/config.{ts,js,tsx}import { defineConfig } from 'tinacms'export default defineConfig({// ...schema: {collections: [//⤵️ 每个项目是一个不同的内容结构{label: '博客文章',name: 'post',path: 'content/posts',fields: [ //⤵️ 每个项目是编辑器中的一个新字段{type: 'string',label: '标题',name: 'title',},{type: 'string',label: '文章正文',name: 'body',isBody: true,},],},{...}],},})