-
I have 2 content types that have a very similar structure: "Page" and "Article", and I'd like to combine the fields that these 2 content types have in common, to avoid repeating the configuration. Kind of an "inheritance" / merge. Is there a way to achieve that? Here is my current config: // ./frontmatter.json
{
"$schema": "https://frontmatter.codes/frontmatter.schema.json",
"frontMatter.extends": ["[[workspace]]/packages/website/config/frontmatter.json"]
} // ./packages/website/config/frontmatter.json
{
"frontMatter.framework.id": "next",
"frontMatter.telemetry.disable": true,
"frontMatter.content.publicFolder": "/apps/website/public",
"frontMatter.taxonomy.tags": [],
"frontMatter.taxonomy.categories": [],
"frontMatter.dashboard.openOnStart": true,
"frontMatter.framework.startCommand": "pnpm dev",
"frontMatter.preview.host": "http://localhost:3000",
"frontMatter.content.autoUpdateDate": true,
"frontMatter.content.pageFolders": [
{
"title": "Articles",
"path": "[[workspace]]/apps/website/cms/articles",
"contentTypes": ["article"]
},
{
"title": "Pages",
"path": "[[workspace]]/apps/website/cms/pages",
"contentTypes": ["page"]
}
],
"frontMatter.taxonomy.seoTitleField": "metaTitle",
"frontMatter.taxonomy.seoDescriptionField": "metaDescription",
"frontMatter.content.draftField": {
"name": "isDraft",
"type": "boolean"
},
"frontMatter.taxonomy.alignFilename": true,
"frontMatter.content.fmHighlight": true,
"frontMatter.content.hideFm": false,
"frontMatter.taxonomy.contentTypes": [
{
"name": "page",
"pageBundle": false,
"previewPath": null,
"fields": [
{
"title": "Title",
"name": "title",
"type": "string"
},
{
"title": "Slug",
"name": "slug",
"type": "slug"
},
{
"title": "Meta Title",
"name": "metaTitle",
"type": "string"
},
{
"title": "Meta Description",
"name": "metaDescription",
"type": "string"
},
{
"title": "Summary Excerpt",
"name": "summary",
"type": "string",
"wysiwyg": true
},
{
"title": "Creation date",
"name": "createdAt",
"type": "datetime",
"default": "{{now}}",
"isPublishDate": true
},
{
"title": "Last modified date",
"name": "updatedAt",
"type": "datetime",
"default": "{{now}}",
"isModifiedDate": true
},
{
"title": "Is in draft",
"name": "isDraft",
"type": "boolean",
"default": false
}
]
},
{
"name": "article",
"pageBundle": false,
"previewPath": null,
"fields": [
{
"title": "Title",
"name": "title",
"type": "string"
},
{
"title": "Slug",
"name": "slug",
"type": "slug"
},
{
"title": "Meta Title",
"name": "metaTitle",
"type": "string"
},
{
"title": "Meta Description",
"name": "metaDescription",
"type": "string"
},
{
"title": "Summary Excerpt",
"name": "summary",
"type": "string",
"wysiwyg": true
},
{
"title": "Creation date",
"name": "createdAt",
"type": "datetime",
"default": "{{now}}",
"isPublishDate": true
},
{
"title": "Last modified date",
"name": "updatedAt",
"type": "datetime",
"default": "{{now}}",
"isModifiedDate": true
},
{
"title": "Is in draft",
"name": "isDraft",
"type": "boolean",
"default": false
},
{
"title": "Banner Image",
"name": "bannerImageUrl",
"type": "image",
"isPreviewImage": true
},
{
"title": "Video URL",
"name": "videoUrl",
"type": "string",
"isPreviewImage": true
},
{
"title": "Tags",
"name": "tags",
"type": "tags"
},
{
"title": "Categories",
"name": "category",
"type": "categories",
"taxonomyLimit": 1,
"multiple": false,
"single": true
}
]
}
]
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
There is the concept of "fieldgroups" that lets you create reusable field groups. I use it mainly to collect data like authors (name, website, description) so I can say I thought I remembered a way where you "extend" the field configuration of content types, but I couldn't find that in the documentation. Might have been just a wishful dream :) |
Beta Was this translation helpful? Give feedback.
-
This has been added in v9.3.0 #682 how to use it: #563 (comment) |
Beta Was this translation helpful? Give feedback.
This has been added in v9.3.0 #682
Thanks to @estruyf
how to use it: #563 (comment)