page.ts (1290B)
1 import type { Collection } from "tinacms"; 2 import { heroBlockSchema } from "../../components/blocks/hero"; 3 import { contentBlockSchema } from "../../components/blocks/content"; 4 import { testimonialBlockSchema } from "../../components/blocks/testimonial"; 5 import { featureBlockSchema } from "../../components/blocks/features"; 6 7 const Page: Collection = { 8 label: "Pages", 9 name: "page", 10 path: "content/pages", 11 ui: { 12 router: ({ document }) => { 13 if (document._sys.filename === "home") { 14 return `/`; 15 } 16 if (document._sys.filename === "about") { 17 return `/about`; 18 } 19 return undefined; 20 }, 21 }, 22 fields: [ 23 { 24 type: "string", 25 label: "Title", 26 name: "title", 27 description: 28 "The title of the page. This is used to display the title in the CMS", 29 isTitle: true, 30 required: true, 31 }, 32 { 33 type: "object", 34 list: true, 35 name: "blocks", 36 label: "Sections", 37 ui: { 38 visualSelector: true, 39 }, 40 templates: [ 41 heroBlockSchema, 42 // eslint-disable-next-line @typescript-eslint/ban-ts-comment 43 // @ts-ignore 44 featureBlockSchema, 45 contentBlockSchema, 46 testimonialBlockSchema, 47 ], 48 }, 49 ], 50 }; 51 52 export default Page;