-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Hey.
I'd like to make my case to add an option to be able to display the slug field alongside the other fields of a collection item.
I think this could be useful in many cases but especially when we want to create collections with only the body
field defined. For example, a 'layout' collection.
const pageLayoutsCollection = {
name: "layouts",
label: "Page Layouts",
label_singular: "Page Layout",
path: "{{slug}}",
folder: `${CONTENT_DIR}/_layouts`,
extension: "html",
format: "yaml-frontmatter",
create: true,
media_folder: `/${CONTENT_DIR}/_images`,
public_folder: "/_images",
fields: [
{
name: "body",
label: "Layout Markup",
widget: "code",
language: "html",
required: false,
output_code_only: true,
allow_language_selection: false,
},
],
};
In this case, the slug is generated as a UUID, which is not practical at all. So we have to save the file first, then Edit Slug
in the drop down menu. It is cumbersome and not what anyone would expect when creating a new entry.
Instead, I suggest an option to display the slug field at the top of the form (at least on creation but I see no harm in leaving it visible). Of course, editing the field should display the same warning as is shown currently to make sure people understand the consequences of editing the field.
Happy to discuss possible technical implementation.