Slug should represent structure in tree collections

When using a slug in a tree-like collection the slug should represent the structure.

I think, if a slug field is added to a model in a tree collection, it makes the most sense to let the slug represent the collection. This way you are able to let editors nest pages and get the content structure they expect from the CMS.

I know Dato is also used for many other cases than websites, but I also think when slugs are used they are mainly targeted websites.

@mads our approach here is to use the slug as an identifier only for the record, not for the entire tree. As you might want to reorder your structure and change your URL accordingly.

What you can do to help your editors is to change what you present in the interface here:

what do you think?

We’ve made a plugin, which builds URL from the slug of the parent record and the current record ({parent_slug}/{current_slug}). You can find it here: https://github.com/SYMBIO/datocms-plugin-tree-url. Feel free to fork it.

2 Likes

@dev3 I can’t find your plugin in the plugin repository. Is it published to npm?

Is it possible for you to make it a public plugin so it can be installed from Dato?

1 Like