You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/configuration.md
+9-11Lines changed: 9 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,11 +104,11 @@ Each content entry can define the following keys:
104
104
| - | - | - |
105
105
| **`name`** | `string` | **Required and must be unique across the content array**. Machine name for the content entry. |
106
106
| **`label`** | `string` | Display name for the collection or single file. This will be displayed in the main menu. |
107
-
| **`type`**| `string` | **Required**. `collection` or `file`, depending on whether the content entry is a collection of files with an identical schema (e.g. blog posts) or a single file (e.g. home page). |
108
-
| **`path`** | `string` | **Required**. Path to the folder where the files are stored if it's a collection (e.g. `path: src/posts`), otherwise the path to the single file (e.g. `path: src/index.md`). |
109
-
| **`fields`** | `array` | The list of fields defining the schema of the content entry (e.g. title, date, author, body, etc). [See the "Fields" section below](#fields). |
110
-
| **`filename`** | `string` | The pattern to generate the filename when creating a new file. You can use the value of any field (e.g. `fields.title`) including nested values (e.g. `fields.tags[0].label`). You can also use a few date tokens (`{year}`, `{month}`, `{day}`) and time (`{hour}`, `{minute}`, `{second}`) and `{primary}` for the primary field as defined in the `view` key. By default this is set to `'{year}-{month}-{day}-{primary}.md'`. |
111
-
| **`exclude`** | `array` | An array of files to exclude from the collection (e.g. `[ README.md ]`). This is only valid for collections. |
107
+
| **`type`**| `string` | **Required**. `collection` or `file`, depending on whether the content entry is a collection of files with an identical schema (e.g. blog posts) or a single file (e.g. home page). |
108
+
| **`path`** | `string` | **Required**. Path to the folder where the files are stored if it's a collection (e.g. `path: src/posts`, otherwise the path to the single file (e.g. `path: src/index.md`). |
109
+
| **`fields`** | `string` | The list of fields defining the schema of the content entry (e.g. title, date, author, body, etc). [See the "Fields" section below](#fields). |
110
+
| **`filename`** | `string` | The pattern to generate the filename when creating a new file. This also defines how files are looked up. You can use the value of any field (e.g. `{{fields.title}}`) including nested values (e.g. `{{fields.tags[0].label}}`). You can also use a few date tokens (`{year}`, `{month}`, `{day}`) and time (`{hour}`, `{minute}`, `{second}`) and `{primary}` for the primary field as defined in the `view` key. By default this is set to `'{year}-{month}-{day}-{primary}.md'`. |
111
+
| **`exclude`** | `array` | An array of files to exclude from the collection (e.g. `[ README.md ]`). This is only valid for collections.
112
112
| **`view`** | `object` | **Only valid for collections**. This object defines the various options for the collection view; visible fields, sorting options and defaults, fields indexed for the search... [See the "View" section below](#view). |
113
113
| **`format`** | `string` | The format of the file, used to set up the editor to edit the content: `yaml-frontmatter`, `json-frontmatter`, `toml-frontmatter`, `yaml`, `json`, `toml`, `datagrid`, `code` or `raw`. It defaults to `yaml-frontmatter`. |
114
114
| **`subfolders`** | `boolean` | Whether or not the collection should display subfolders. Default to `true`. Set to `false` if you want to force the collection of files to be "flat". |
@@ -256,12 +256,10 @@ Fields define the structure and data types for your content entries or [componen
256
256
| **`default`** | (any) | Default value for the field when a new entry is created. |
257
257
| **`list`** | `boolean` or `object` | If truthy, the field is an array of values (of the type defined for the field). [See the "List" section below](#list). |
258
258
| **`hidden`** | `boolean` | If `true`, the field will not be displayed in the form but will be saved. It is usually used with `default` to set a required field that shouldn't be edited by users, like for example the language of a post (`lang: en-US`). |
259
-
| **`required`** | `boolean` | If `true`, the field cannot be empty or unselected. Validation rules depend on the field type. |
260
-
| **`pattern`** | `string` or `object` | A regular expression to validate the field (primarily for string-based types). A custom error message can be provided by defining an object with `regex` and `message` attributes (e.g. `pattern: { regex: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$', message: 'This must be a valid email address (e.g. hello@example.com).' }`). |
261
-
| **`fields`** | `array` | **Required if `type` is `object` and no `component` is defined**. Defines the nested fields within the object. Each element follows the standard Field definition structure. |
262
-
| **`blocks`** | `array` | **Required if `type` is `block`**. An array of block definitions allowed within this field. Each element in the array is an object following the [Field](#fields) definition structure (it must have a unique `name` and can optionally use `component` or define its own `fields`). |
263
-
| **`blockKey`** | `string` | **Only valid if `type` is `block`**. Specifies the key used to identify the chosen block type within the data object. Defaults to `_block`. For example, if `blockKey: block_type`, the chosen block's data would look like `{ block_type: 'hero', ... }`. |
264
-
| **`options`** | `object` | Contains type-specific configuration options for the field. Refer to the documentation for each [Field Type](#field-types) for available options. |
259
+
| **`required`** | `boolean` | If `true`, the field can't be empty. |
260
+
| **`pattern`** | `string` or `object` | A regular expression to validate the field. A custom message for the error can be provided by defining an object with `regex` and `message` attributes (e.g. `pattern: { message: 'This must be a valid email address (e.g. hello@example.com).', regex: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$' }`) |
261
+
| **`fields`** | `array` | **Only valid for object fields**. List of the fields in that object. |
262
+
| **`options`** | `object` | Options for that field. Refer to the field specific details below. |
Copy file name to clipboardExpand all lines: src/docs/configuration/date-field.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Either a date or a date and time field, similar to the [date](ttps://developer.m
11
11
|**`format`**|`string`| The date (or datetime) format (e.g. `dd/MM/yyyy`). This should be a valid [date-fns format string](https://date-fns.org/v3.6.0/docs/format). Default to `yyyy-MM-dd`, or `yyyy-MM-dd'T'HH:mm` if `time` is `true` (see below). |
12
12
|**`time`**|`string`| If `true`, the field will allow the user to pick a date and a time using a `<datetime>` field. Default is `false`. |
13
13
|**`min`**|`string`| The earliest date to accept. If undefined, there is no min date. **This must be formatted as a standard [min value for a date input (i.e. `yyyy-mm-dd`)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#min) or [min value for a datetime input (i.e. `YYYY-MM-DDThh:mm`)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#min)**. |
14
-
|**`min`**|`string`| The latest date to accept. If undefined, there is no max date. **This must be formatted as a standard [max value for a date input (i.e. `yyyy-mm-dd`)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#max) or [max value for a datetime input (i.e. `YYYY-MM-DDThh:mm`)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#max)**. |
14
+
|**`max`**|`string`| The latest date to accept. If undefined, there is no max date. **This must be formatted as a standard [max value for a date input (i.e. `yyyy-mm-dd`)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#max) or [max value for a datetime input (i.e. `YYYY-MM-DDThh:mm`)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#max)**. |
15
15
|**`step`**|`string`| Defines the granularity of values: number of days, or number of seconds if `time` is set to `true`. Behavior is the same as step for [date](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date) and [datetime](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local) inputs. |
0 commit comments