Skip to content

Commit

Permalink
decaporg#407 Setup second collection with filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Correia committed May 12, 2017
1 parent a9c175c commit 492e295
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
29 changes: 28 additions & 1 deletion example/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ media_folder: "assets/uploads"

collections: # A list of collections the CMS should be able to edit
- name: "posts" # Used in routes, ie.: /admin/collections/:slug/edit
label: "Post" # Used in the UI, ie.: "New Post"
label: "(EN) Post" # Used in the UI, ie.: "New Post"
folder: "_posts"
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
create: true # Allow users to create new documents in this collection
Expand All @@ -32,6 +32,33 @@ collections: # A list of collections the CMS should be able to edit
- {label: "Answer", name: "body", widget: "markdown"}
card: {type: "alltype", text: "title"}

- name: "posts-pt" # Used in routes, ie.: /admin/collections/:slug/edit
label: "(PT) Post" # Used in the UI, ie.: "New Post"
folder: "_posts"
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
create: true # Allow users to create new documents in this collection
filter:
field: language
value: pt
fields: # The fields each document in this collection have
- {label: "Title", name: "title", widget: "string", tagname: "h1"}
- {label: "Publish Date", name: "date", widget: "datetime", format: "YYYY-MM-DD hh:mma"}
- {label: "Language", name: "language", widget: "string"}
- {label: "Cover Image", name: "image", widget: "image", required: false, tagname: ""}
- {label: "Body", name: "body", widget: "markdown"}
meta:
- {label: "SEO Description", name: "description", widget: "text"}
card: {type: "image", image: "image", text: "title"}

- name: "faq" # Used in routes, ie.: /admin/collections/:slug/edit
label: "FAQ" # Used in the UI, ie.: "New Post"
folder: "_faqs"
create: true # Allow users to create new documents in this collection
fields: # The fields each document in this collection have
- {label: "Question", name: "title", widget: "string", tagname: "h1"}
- {label: "Answer", name: "body", widget: "markdown"}
card: {type: "alltype", text: "title"}

- name: "settings"
label: "Settings"
editor:
Expand Down
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
content: "---\nlanguage: en\ntitle: This post should not appear because the extension is different\nimage: /nf-logo.png\ndate: 2015-02-14T00:00:00.000Z\n---\n\n# I Am a Title in Markdown\n\nHello, world\n\n* One Thing\n* Another Thing\n* A Third Thing\n"
},
"2017-05-15-this-is-a-post-with-a-different-language.pt.md": {
content: "---\nlanguage: pt\ntitle: This post should not appear because the language is different\nimage: /nf-logo.png\ndate: 2015-02-14T00:00:00.000Z\n---\n\n# I Am a Title in Markdown\n\nHello, world\n\n* One Thing\n* Another Thing\n* A Third Thing\n"
content: "---\nlanguage: pt\ntitle: This post should appear in a separate collection because the language is different\nimage: /nf-logo.png\ndate: 2015-02-14T00:00:00.000Z\n---\n\n# I Am a Title in Markdown\n\nHello, world\n\n* One Thing\n* Another Thing\n* A Third Thing\n"
}
},
_faqs: {
Expand Down

0 comments on commit 492e295

Please sign in to comment.