From 9a023e6a45e507dfc75dbf3a7b795b6f42a0b809 Mon Sep 17 00:00:00 2001 From: Eric Jinks Date: Wed, 28 Mar 2018 10:44:33 +1000 Subject: [PATCH] update posts and postCategories slug/relation --- public/admin/config.yml | 4 ++-- src/App.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/admin/config.yml b/public/admin/config.yml index 70e9406..51e6bd0 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -65,7 +65,7 @@ collections: # A list of collections the CMS should be able to edit editor: preview: false folder: content/posts - slug: "{{slug}}" + slug: "{{year}}-{{month}}-{{day}}-{{slug}}" create: true # Allow users to create new documents in this collection fields: # The fields each document in this collection have - {label: Title, name: title, widget: string} @@ -83,7 +83,7 @@ collections: # A list of collections the CMS should be able to edit widget: "relation" collection: "postCategories" searchFields: ["title"] - valueField: "title" + valueField: "name" - {label: Date / Order, name: date, widget: date} - {label: Post Featured Image, name: postFeaturedImage, widget: image, required: false} - {label: Excerpt, name: excerpt, widget: text} diff --git a/src/App.js b/src/App.js index 700fe0d..7001752 100644 --- a/src/App.js +++ b/src/App.js @@ -74,7 +74,7 @@ class App extends Component { ) const categoriesFromPosts = getCollectionTerms(posts, 'categories') const postCategories = this.getDocuments('postCategories').filter( - category => categoriesFromPosts.indexOf(category.title.toLowerCase()) >= 0 + category => categoriesFromPosts.indexOf(category.name.toLowerCase()) >= 0 ) return (