Content Type & Nested Pages

Hi,

This might be a dumb question but is there a possibility to
define models/schema to a page-like structure? I was thinking
if it’s possible for a user to not touch the models so when creating new pages
it will just be in the content section. Another thing would be to define nested pages.

How would you achieve these in DatoCMS?

Thanks :pray:

I broke my page’s data into two models (page and content).

Page contains all the meta info about the article, its url, etc and it has a link to a “content” record. An admin would create this page.

The content that is linked to from it contains just the body of our articles. Writers would create these records.

2 Likes

Hello!

If an editor needs to create a new page, they shouldn’t touch the schema, otherwise your frontend won’t know how to render that new model.

What you can do is to use a tree-like structure ( https://www.datocms.com/docs/content-modelling/trees ) with a page model and then have a modular content with a set of modular blocks that you have defined.

If that is not enough, you can still keep the tree-like structure to create pages and then instead of having the modular content you link to other models where you can define all the different templates that you have implemented.

Does this help?

1 Like

Interesting approach! I think this could actually work.
Thanks!

1 Like

I might follow this approach as well. Thank you!

Hi,

Is it possible for the root/parent to not have a schema, just the children?

You can leave the root element without blocks, but it will have the modular content field, which will be empty.

But all the records of an item type must have the same schema. If you want to prevent your editors to write in the root element you might build a plugin that hides the field if the record is top level maybe?

Thanks for responding, I was just wondering if it’s an out of the box solution.
Maybe in the future I could do try doing a plugin :slight_smile:

1 Like