Feat: nested collections (#3716)

This commit is contained in:
Erez Rokah
2020-06-18 10:11:37 +03:00
committed by GitHub
parent b4c47caf59
commit af7bbbd9a9
89 changed files with 8269 additions and 5619 deletions

View File

@ -45,8 +45,6 @@ collections: # A list of collections the CMS should be able to edit
tagname: ''
- { label: 'Body', name: 'body', widget: 'markdown', hint: 'Main content goes here.' }
meta:
- { label: 'SEO Description', name: 'description', widget: 'text' }
- name: 'faq' # Used in routes, ie.: /admin/collections/:slug/edit
label: 'FAQ' # Used in the UI
@ -247,3 +245,14 @@ collections: # A list of collections the CMS should be able to edit
- { label: 'Date', name: 'date', widget: 'date' }
- { label: 'Image', name: 'image', widget: 'image' }
- { label: 'File', name: 'file', widget: 'file' }
- name: pages # a nested collection
label: Pages
label_singular: 'Page'
folder: _pages
create: true
nested: { depth: 100 }
fields:
- label: Title
name: title
widget: string
meta: { path: { widget: string, label: 'Path', index_file: 'index' } }

View File

@ -74,6 +74,36 @@
content: "---\ntitle: \"This FAQ item # " + i + "\"\ndate: " + dateString + "T00:99:99.999Z\n---\n\n# Loren ipsum dolor sit amet"
}
}
window.repoFiles._pages = {
directory: {
'sub-directory': {
'nested-directory': {
'index.md': {
path: '_pages/directory/sub-directory/nested-directory/index.md',
content: '---\ntitle: "Nested Directory"\n---\n',
},
},
'index.md': {
path: '_pages/directory/sub-directory/index.md',
content: '---\ntitle: "Sub Directory"\n---\n',
},
},
'another-sub-directory': {
'index.md': {
path: '_pages/directory/another-sub-directory/index.md',
content: '---\ntitle: "Another Sub Directory"\n---\n',
},
},
'index.md': {
path: '_pages/directory/index.md',
content: '---\ntitle: "Directory"\n---\n',
},
},
'index.md': {
path: '_pages/index.md',
content: '---\ntitle: "Root Page"\n---\n',
},
};
</script>
</head>
<body>