Skip to content

Commit

Permalink
TinaCMS content update
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Wicks <[email protected]>
  • Loading branch information
tina-cloud-app[bot] and wicksipedia authored Oct 29, 2024
1 parent be0a265 commit 73e824c
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions content/docs/reference/collections.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
id: collections

title: Collections
last_edited: '2023-03-01T15:51:56.737Z'
last_edited: '2024-10-29T07:27:46.292Z'
next: content/docs/reference/fields.mdx
previous: content/docs/reference/schema.mdx
---
Expand All @@ -16,21 +15,23 @@ Collections represent a type of content (EX, blog post, page, author, etc). We r
| [`name`](#name) | The name of the collection |
| [`path`](#path) | The path (relative to where the CLI is running) to a folder where the content is stored. |
| [`format`](#format) | The extension of all the documents in this collection (Default is "md"). Must be one of `"md"`, `"markdown"`, `"mdx"`,`"json"`, `"toml"`, or `"yaml"`. |
| [`match.include`](#match.include) | A [glob pattern](<https://en.wikipedia.org/wiki/Glob_(programming)>) (without the file extension) that will be used to match a subset of the files in the `path` folder. |
| [`match.exclude`](#match.exclude) | A [glob pattern](<https://en.wikipedia.org/wiki/Glob_(programming)>) (without the file extension) that will be used to exclude a subset of the files in the `path` folder. |
| [`match.include`](#match.include) | A [glob pattern](https://en.wikipedia.org/wiki/Glob_\(programming\)) (without the file extension) that will be used to match a subset of the files in the `path` folder. |
| [`match.exclude`](#match.exclude) | A [glob pattern](https://en.wikipedia.org/wiki/Glob_\(programming\)) (without the file extension) that will be used to exclude a subset of the files in the `path` folder. |
| `label` | A human friendly label that will be displayed to the user |
| `fields` | An array of [fields](/docs/reference/fields/) |
| `templates` | An array of [templates](/docs/reference/templates/) |
| [`defaultItem`](#defaultitem) | An object or a function that returns an object. The object that is returned will be the data used as the default data when a new document is created. |
| `frontmatterFormat` | The format used to parse the frontmatter. This can be `"yaml"` ,`"toml"`, or `"json"`. It defaults to `"yaml"` |
| `frontmatterDelimiters` | The Delimiters used for the frontmatter for a document. This is what Has type `string \| [string, string]` . The default is `---`. Read more about delimiters [here](https://github.com/jonschlinkert/gray-matter#optionsdelimiters) |
| `ui.filename` | See [Filename customization](/docs/extending-tina/filename-customization/) |
| `ui.beforeSubmit` | This function is called before the form is submitted. If values are returned from this function they will be the values used to submit the form. (_optional_) |
| `ui.global` | A boolean that if true will make this collection Global. (_optional_) |
| `ui.router` | A function that takes in a document and returns the route for it. If nothing is returned the basic editor will be used. Read more about visual editing [here](/docs/contextual-editing/router/#the-router-property)(_optional_) |
| `ui.allowedActions.create` | If this is false, the create button will not appear in the collection list page. See [example](#example-with-allowed-actions). (_optional_) |
| `ui.allowedActions.delete` | If this is false, the create delete button will not appear in the collection list page. See [example](#example-with-allowed-actions). (_optional_) |
| `ui.allowedActions.createNestedFolder` | If this is false, the create folder button will not appear in the collection list page. See [example](#example-with-allowed-actions). (_optional_) |
| `ui.beforeSubmit` | This function is called before the form is submitted. If values are returned from this function they will be the values used to submit the form. (*optional*) |
| `ui.global` | A boolean that if true will make this collection Global. (*optional*) |
| `ui.router` | A function that takes in a document and returns the route for it. If nothing is returned the basic editor will be used. Read more about visual editing [here](/docs/contextual-editing/router/#the-router-property)(*optional*) |
| `ui.allowedActions.create` | If this is false, the create button will not appear in the collection list page. See [example](#example-with-allowed-actions). (*optional*) |
| `ui.allowedActions.delete` | If this is false, the create delete button will not appear in the collection list page. See [example](#example-with-allowed-actions). (*optional*) |
| `ui.allowedActions.createNestedFolder` | If this is false, the create folder button will not appear in the collection list page. See [example](#example-with-allowed-actions). (*optional*) |
| `ui.filename.description` | A short description for the filename field that will be displayed to the user (*optional*, can include html formatting e.g. style attributes) |
| `ui.filename.showFirst` | A boolean that if true will render the filename field at the top of the form (*optional*, default `false`) |

> Note: Must provide only one of `fields` or `templates` but never both
Expand Down Expand Up @@ -78,7 +79,7 @@ export const defineConfig({

## match.include

A [glob pattern](<https://en.wikipedia.org/wiki/Glob_(programming)>) that will be used to match a subset of the files in the `path` directory.
A [glob pattern](https://en.wikipedia.org/wiki/Glob_\(programming\)) that will be used to match a subset of the files in the `path` directory.

The provided pattern does not have to include the file extension. The extension will be added automatically based on the [`format`](#format) of the collection. The final pattern that is used will be determined by `match`, `format` and `path`.

Expand All @@ -101,11 +102,11 @@ The final pattern used would be

### Basic Syntax

- `?` matches a single character
- `*` matches any number of any characters (except `/`)
- `[abc]` matches any one character in the given set
- `[a-z]` matches a range.
- `{foo,bar}` matches any whole word in the given set
* `?` matches a single character
* `*` matches any number of any characters (except `/`)
* `[abc]` matches any one character in the given set
* `[a-z]` matches a range.
* `{foo,bar}` matches any whole word in the given set

### Some common glob patterns

Expand Down

0 comments on commit 73e824c

Please sign in to comment.