update posts and postCategories slug/relation

This commit is contained in:
Eric Jinks 2018-03-28 10:44:33 +10:00
parent 329997385f
commit 9a023e6a45
2 changed files with 3 additions and 3 deletions

View file

@ -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}

View file

@ -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 (