-
-
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
Widget docs a bit thin #619
Comments
Thanks a lot for the issue. I already knew our docs needed some work, but it's great to have reports of particularly sparse areas that are tripping people up. |
Thanks for the detailed report! I'm using this issue to track improvements to the widget docs as I break up the outline from #598. Here's the Widgets section:
The UI sample part may wait until the new UI is in place, but the rest can start now, and would definitely be an improvement. |
Just noticed that #486 is related to this work as well. |
Take me hours to understand the widget parts, I'm pretty new in static CMS and finally found this issue posted! pheew thanks @benogle for pointing it out. |
@benogle you pretty much described my journey as well, a lot of hours were spent with browsersync and a trial and error process with the config.yml file! |
I don't have time this red hot second, but we should make a list of the specific issues outlined in @benogle's OP and check them off before closing. Even after @verythorough's extensive reboot of our documentation, a number of them still need to be addressed, such as images of how the widget looks to aid in grokability. @hcavalieri's PR will help a ton :) |
Here's what I've pulled from the OP:
I can file an issue (#910) for adding the widget code samples to the example config and then screenshotting them for the Widget doc. For the relation widget limitation, I can add that note about as quickly as I can write an issue for it, so I'll just make a PR. (#911) For the last two items (enum widgets and nested collections), @benogle could you confirm that I've characterized your issue properly? |
@verythorough an |
Yep, this list seems great, and the docs look better already. ❤️ ❤️ for taking my rambling account super seriously :) |
What is the solution to @benogle's original question? How do I specify a relation to a nested collection like that? I'm trying to add post authors - feels like a quite common use case so I'm curious how to solve this? Thanks! |
@ffdead Previously missing and erroneous information in the docs implied that it was possible to create a single-file "collection" and nest it under a We've revised the Collection Types doc to clarify the available options: a collection can be either a In the case of having an author collection, I'd recommend making a |
@verythorough Hi, I'm trying to wrap my head around this: so if I just like to have a relation field in a blog post called "tags", and it's a pretty much preset list (and a tag only has a name prop) … In order to build a usable relation field I then need to create a folder "tags" as a collection where each tag must have its own file? I've seen plenty of examples having an authors.yml file where all authors are listed, but that won't work as a relation field? If I'd still prefer to have the list of tags in a single file, would that require building a custom widget? |
Yep, the relation widget works only at the I would expect that this functionality could be patched onto the existing relation widget, and you'd provide an additional # config.yml
collections:
- name: meta
label: Meta
files:
- name: tags
label: Tags
file: data/tags.yaml
fields:
- name: tags
label: Tags
widget: list
fields: [{ name: tag, label: Tag }]
- name: blog
label: Blog
create: true
folder: content/blog
fields:
- { name: title, label: Title }
- { name: body, label: Body, widget: markdown }
- name: tags
label: Tags
widget: relation
collection: meta
entry: tags
searchFields: ['tags']
multiselect: true # data/tags.yml
- { tag: my-tag }
- { tag: another-tag }
Unfortunately Netlify CMS doesn't support data files that contain a top level array, but that would make this even better. Support for that is in the works under #468. |
Thanks for the pointers @erquhart! I'll take a closer look at the relation widget. Both PRs you mentioned seems to be inactive, but still functionality you'd like to see added to the project right? Also, seems like there's a few other related WIPs: #922 (multiselect for fixed values that can be set in the config.yml) and #1100 |
I'm going to close this as it has generally been fixed or covered in other ways. Looking at he unchecked items in the list in my comment above:
|
I appreciate you all doing something with this. So many projects would just let a rambly issue like this languish. |
I setup netlify cms for the first time yesterday and had / still have some trouble getting the widgets to do what I want(ed). There is a lot here, but I thought it better to be cohesive than 6 issues. Here was my discovery process after having known what a widget was for < 5 minutes.
First I went to the quick start, and setup my config. There is a section of the widgets in the collections section, and the table indicates some widgets. Initially I thought that those were all the widgets that were supported. I admittedly didnt see the
Widgets
link on the left sidebar. A link to the widgets page would have been nice right after the table e.g. 'here are all the widgets we support'.I wanted an enum widget or something like it, so I searched google for enum widget, to no avail. I finally found the widgets link in the sidebar, and saw that there is a select and a list widget.
The
list
widget seemed like a candidate, but was a little complicated to grok at first. I think an image of the what each of the examples produces would be helpful.The
object
widget seems like I could probably use it and there are probably many options, but there is no example section, so I am not sure what it is for.The
select
widget has no example or usage instructions, but seemed like the best candidate. So I searched for it (https://www.google.com/search?q=netlify+select+widget) but didnt come up with anything specific, so I wasnt sure.The top result was https://github.com/netlify/netlify-cms/blob/master/example/config.yml, which was huge. Yay, examples. IMO, this should be linked to in the Widgets docs page.
But there is a lot there that is not covered in any docs. e.g. File and folder collections. Nested collections
The
settings.author
situation seems really interesting, and it seems like I could reference the authors in arelation
widget. But none of therelation
examples show how to work with a nested collection. What goes in thecollection
field?authors
?settings.authors
? Something else? I couldnt get anything to work (Cannot read property 'get' of undefined
on the post page). I also tried a top level collection:But that gave me an error about collections being a file or folder. There is a file specified, I thought, but it seems there needs to be
files
orfolder
.Overall, I felt like I was constantly guessing and checking when setting up the config. There are other more complicated things I want to do like have a list of categories we can pick in the post UI, get the authors relation to work, etc. But I am hesitant to spend a bunch of time spelunking, so most everything is a string.
It would be nice to have a some really complete examples that show all the things that are possible linked to from the widget docs page. Or complete for common usecases. The example authors case would be amazing if a
relation
widget handled it in the example config. I assume a categories or tags case could be handled similarly.I see there is #598 so maybe these things are slated in that work. Hopefully this account is helpful. I've written my share of docs, and it is always hard to know where people get stuck.
The text was updated successfully, but these errors were encountered: