Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule Collection – Improving the Schema #1539

Merged
merged 6 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions tina/collections/rules.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,59 @@
import { Collection } from "tinacms";
import { generateGuid } from "../../src/helpers/generateGuid";

export const Rules: Collection = {
label: 'Rules',
name: 'rules',
path: '/rules',
format: 'md',
defaultItem: () => {
return {
guid: generateGuid(),
created: new Date().toISOString(),
bradystroud marked this conversation as resolved.
Show resolved Hide resolved
filename: 'rule',
}
},
ui: {
filename: {
readonly: true,
},
},
fields: [
{
type: 'string',
name: 'title',
label: 'Title',
required: true,
description: 'This is used as the major heading for the rule.',
},
{
type: 'string',
name: 'uri',
label: 'Uri',
description: 'The URI of the rule – this defines the slug and refereces.',
required: true,
},
{
type: 'object',
name: 'authors',
label: 'Authors',
description: 'The list of contributors for this rule.',
list: true,
ui: {
itemProps: (item) => {
return { label: 'πŸ‘€ ' + (item?.title ?? "Author") };
},
},
fields: [
{
type: 'string',
name: 'title',
description: 'The full name of the contributor, as it should appear on the rule.',
label: 'Name',
},
{
type: 'string',
description: 'The SSW People link for the contributor – e.g. https://ssw.com.au/people/sebastien-boissiere',
name: 'url',
label: 'Url',
},
Expand All @@ -40,6 +63,7 @@ export const Rules: Collection = {
type: 'string',
label: 'Related Rules',
name: 'related',
description: 'The URIs of rules that should be suggested based on the content of this rule.',
list: true,
},
{
Expand All @@ -51,27 +75,40 @@ export const Rules: Collection = {
{
type: 'datetime',
name: 'created',
description: 'If you see this field, contact a dev immediately 😳 (should be a hidden field generated in the background).',
label: 'Created',
ui: {
component: 'hidden',

}
},
{
type: 'string',
name: 'archivedreason',
label: 'Archived Reason',
description: 'If this rule has been archived, summarise why here.',
},
{
type: 'string',
name: 'guid',
label: 'Guid',
description: 'If you see this field, contact a dev immediately 😳 (should be a hidden field generated in the background).',
ui: {
component: 'hidden',

}
},
{
type: 'string',
name: 'seoDescription',
label: 'SEO Description',
description: 'A summary of the page content, used for SEO purposes. This can be generated automatically with AI.',
},
{
type: 'rich-text',
name: 'body',
label: 'Body',
description: 'Rule content. This is where the magic happens.',
isaaclombardssw marked this conversation as resolved.
Show resolved Hide resolved
isBody: true,
},
],
Expand Down
Loading
Loading