57 lines
991 B
TypeScript
57 lines
991 B
TypeScript
|
import type { Collection } from "tinacms";
|
||
|
|
||
|
const Post: Collection = {
|
||
|
label: "Posts",
|
||
|
name: "post",
|
||
|
path: "content/posts",
|
||
|
format: "mdx",
|
||
|
ui: {
|
||
|
router: ({ document }) => {
|
||
|
return `/posts/${document._sys.filename}`;
|
||
|
},
|
||
|
},
|
||
|
fields: [
|
||
|
{
|
||
|
type: "string",
|
||
|
label: "Title",
|
||
|
name: "title",
|
||
|
isTitle: true,
|
||
|
required: true,
|
||
|
},
|
||
|
{
|
||
|
type: "image",
|
||
|
name: "heroImg",
|
||
|
label: "Hero Image",
|
||
|
},
|
||
|
{
|
||
|
type: "rich-text",
|
||
|
label: "Excerpt",
|
||
|
name: "excerpt",
|
||
|
},
|
||
|
{
|
||
|
type: "reference",
|
||
|
label: "Author",
|
||
|
name: "author",
|
||
|
collections: ["author"],
|
||
|
},
|
||
|
{
|
||
|
type: "datetime",
|
||
|
label: "Published Date",
|
||
|
name: "date",
|
||
|
ui: {
|
||
|
dateFormat: "MMMM DD YYYY",
|
||
|
timeFormat: "hh:mm A",
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
type: "rich-text",
|
||
|
label: "Body",
|
||
|
name: "_body",
|
||
|
templates: [],
|
||
|
isBody: true,
|
||
|
},
|
||
|
],
|
||
|
};
|
||
|
|
||
|
export default Post;
|