-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for setting custom identifier field #1543
Conversation
Deploy preview for netlify-cms-www ready! Built with commit ff955cb |
Deploy preview for cms-demo ready! Built with commit ff955cb |
Thanks for this! Just a heads up: anything that touches the slug requires thorough examination. Your changes are quite simple, it's the impact to seemingly unrelated parts of the project that we need to be sure about. Apologies this was overlooked for so long! We'll get it reviewed soon. |
Great. Thanks for the update. |
Also would like to see this merged. This + support for custom slug synthesis from fields is the dream. |
@radusuciu you can reference fields by name as placeholders in the |
1ef2c52
to
ff955cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased, looks good to me - thanks @ascorbic!
Also tested locally.
I started using Netlify CMS just today, and ran into this issue straight away 😅 In my index.html I'm getting the script from Right now I'm stuck with this error:
And my collection config is this: collections:
- name: artists
label: Artists
label_singular: Artist
folder: data/artists
identifier_field: name
create: true
fields:
- { label: 'Name', name: 'name', widget: 'string', description: 'The artist name' }
- { label: 'Company Name', name: 'company_name', widget: 'string', description: 'The company name (optional)', required: false }
- { label: 'Image', name: 'image', widget: 'image', description: A profile image }
- { label: 'Short', name: 'short', widget: 'string', description: 'A short one-liner description' }
- { label: 'Link', name: 'link', widget: 'string', description: 'A link to the artists website or other external resource' }
- { label: 'Building Nr', name: 'building', widget: 'select', options: [1, 2, 3] }
- { label: 'House Nr', name: 'house', widget: number } |
Ah I see. This is merged but not published yet as a new version, right? |
Yep, coming soon. |
- Summary
Sometimes
title
doesn't make sense as the identifier for a collection. For example I have a JSON collection calledclients
, which has aname
field which I want to use for the slug. This PR adds support for anidentifier_field
setting for collections, which lets the user choose a different identifier field.Closes #1802, #1700.
- Test plan
Try using the following collection:
- Description for the changelog
Allow identifier fields other than title or path.
- A picture of a cute animal (not mandatory but encouraged)