diff --git a/package.json b/package.json index 2f19a080..aca84ad8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build:docs": "cd packages/docs && yarn build", "dev": "lerna run dev --scope @staticcms/core", "demo": "lerna run dev --scope @staticcms/demo", - "docs": "lerna run dev --scope docs", + "docs": "lerna run dev --scope @staticcms/docs", "format": "lerna run format", "lint": "lerna run lint", "prepare": "husky install", diff --git a/packages/docs/content/docs/collection-types.mdx b/packages/docs/content/docs/collection-types.mdx index ba530f36..4b31cf75 100644 --- a/packages/docs/content/docs/collection-types.mdx +++ b/packages/docs/content/docs/collection-types.mdx @@ -294,7 +294,89 @@ Supports all of the [`slug` templates](/docs/configuration-options#slug) and: ### Nested Collections Beta Feature. Use at your own risk -[Nested collections](/docs/beta-features/#nested-collections) is a beta feature that allows a folder collection to show a nested structure of entries and edit the locations of the entries. This feature is useful when you have a complex folder structure and may not want to create separate collections for every directory. As it is in beta, please use with discretion. +Nested collections is a beta feature that allows a folder collection to show a nested structure of entries and edit the locations of the entries. This feature is useful when you have a complex folder structure and may not want to create separate collections for every directory. As it is in beta, please use with discretion. + +Example configuration: + + + +```yaml +collections: + - name: pages + label: Pages + label_singular: 'Page' + folder: content/pages + create: true + # adding a nested object will show the collection folder structure + nested: + depth: 100 # max depth to show in the collection tree + summary: '{{title}}' # optional summary for a tree node, defaults to the inferred title field + fields: + - label: Title + name: title + widget: string + - label: Body + name: body + widget: markdown + # adding a meta object with a path property allows editing the path of entries + # moving an existing entry will move the entire sub tree of the entry to the new location + meta: { path: { widget: string, label: 'Path', index_file: 'index' } } +``` + +```js +{ + "collections": [ + { + "name": "pages", + "label": "Pages", + "label_singular": "Page", + "folder": "content/pages", + "create": true, + "nested": { + "depth": 100, + "summary": "{{title}}" + }, + "fields": [ + { + "label": "Title", + "name": "title", + "widget": "string" + }, + { + "label": "Body", + "name": "body", + "widget": "markdown" + } + ], + "meta": { + "path": { + "widget": "string", + "label": "Path", + "index_file": "index" + } + } + } + ] +} +``` + + + +Nested collections expect the following directory structure: + +```bash +content +└── pages + ├── authors + │ ├── author-1 + │ │ └── index.md + │ └── index.md + ├── index.md + └── posts + ├── hello-world + │ └── index.md + └── index.md +``` ## File Collections