diff --git a/dev-test/config.yml b/dev-test/config.yml
index adc72647..57613297 100644
--- a/dev-test/config.yml
+++ b/dev-test/config.yml
@@ -106,6 +106,38 @@ collections: # A list of collections the CMS should be able to edit
- { label: 'Name', name: 'name', widget: 'string', hint: 'First and Last' }
- { label: 'Description', name: 'description', widget: 'markdown' }
+ - name: 'settings-singular'
+ label: 'Settings Singular'
+ icon: 'settings'
+ delete: false # Prevent users from deleting documents in this collection
+ editor:
+ preview: false
+ files:
+ - name: 'general'
+ label: 'Site Settings'
+ file: '_data/settings.json'
+ description: 'General Site Settings'
+ fields:
+ - { label: 'Global title', name: 'site_title', widget: 'string' }
+ - label: 'Post Settings'
+ name: posts
+ widget: 'object'
+ fields:
+ - {
+ label: 'Number of posts on frontpage',
+ name: front_limit,
+ widget: number,
+ min: 1,
+ max: 10,
+ }
+ - { label: 'Default Author', name: author, widget: string }
+ - {
+ label: 'Default Thumbnail',
+ name: thumb,
+ widget: image,
+ class: 'thumb',
+ required: false,
+ }
- name: 'kitchenSink' # all the things in one entry, for documentation and quick testing
label: 'Kitchen Sink'
folder: '_sink'
diff --git a/packages/netlify-cms-core/src/components/App/App.js b/packages/netlify-cms-core/src/components/App/App.js
index 2892fe98..b7f14ae2 100644
--- a/packages/netlify-cms-core/src/components/App/App.js
+++ b/packages/netlify-cms-core/src/components/App/App.js
@@ -74,13 +74,16 @@ function getDefaultPath(collections) {
/**
* Returns default collection name if only one collection
- *
+ *
* @param {Collection} collection
* @returns {string}
*/
function getDefaultCollectionPath(collection) {
if (collection.has('files') && collection.get('files').size === 1) {
- return `/collections/${collection.get('name')}/entries/${collection.get('files').first().get('name')}`;
+ return `/collections/${collection.get('name')}/entries/${collection
+ .get('files')
+ .first()
+ .get('name')}`;
}
return null;
@@ -97,7 +100,7 @@ function RouteInCollectionDefault({ collections, render, ...props }) {
return ;
}
- const defaultCollectionPath = getDefaultCollectionPath(collections);
+ const defaultCollectionPath = getDefaultCollectionPath(collectionExists);
if (defaultCollectionPath !== null) {
return ;
}
diff --git a/packages/netlify-cms-core/src/components/Editor/Editor.js b/packages/netlify-cms-core/src/components/Editor/Editor.js
index 284c192d..a6edd935 100644
--- a/packages/netlify-cms-core/src/components/Editor/Editor.js
+++ b/packages/netlify-cms-core/src/components/Editor/Editor.js
@@ -447,6 +447,10 @@ function mapStateToProps(state, ownProps) {
editorBackLink = `/workflow`;
}
+ if (collection.has('files') && collection.get('files').size === 1) {
+ editorBackLink = '/';
+ }
+
if (collection.has('nested') && slug) {
const pathParts = slug.split('/');
if (pathParts.length > 2) {