Seeking Guidance for Optimizing Content Models in DatoCMS

Hey everyone! :wave:

Ive been working with DatoCMS for a little while now, and Im loving it so far. However, I feel like there might be some room for improvement in how I am setting up my content models. I have got a few complex models that Iā€™m sure could be optimized better, especially when it comes to relationships and field types.

I have gone through these resources/articles Introduction ā€” Content modelling ā€” DatoCMS what is blue prism and they are quite good but I wanted to learn more from community.

For those of you who have been using DatoCMS for a while, do you have any tips or best practices for optimizing content models? How do you approach setting up relationships between models, and are there any common pitfalls to avoid?

Any advice or insights would be super helpful! :pray:

Thanks in advance! :blush:

Marksmith

Hi @marksmit991,

Welcome to Dato!

First, aside from the developer documentation (which you linked to), have you also seen our editor user guides? That goes into a lot more detail about modeling: How to DatoCMS ā€” DatoCMS. You can also take a look at some of our example starter projects, which have one-click quickstarts, to see how theyā€™re modeled in DatoCMS and how that links to the frontend: Project starters - Free demo projects - Marketplace

Beyond that, weā€™re happy to suggest some schemas for your individual use case, but I wouldnā€™t say thereā€™s necessarily a ā€œbestā€ way to model any given content. It really depends on what youā€™re modeling and what sorts of lookups you want to be able to do on that content afterward. Half the fun of setting up a new CMS is the trial and error lucky guesses, I mean, totally measured and reasoned approach to setting up the schema :wink: Seriously though, itā€™s usually a bit of significant back and forths before you get it right at first, with more minor changes later on.

It helps to not spend too much time putting in real content right off the bat, but rather, using dummy content (just one or two of each category/model) to make sure the schema makes sense before you start adding all the real stuff.

What are you trying to model? A blog site would be different from a restaurant menu would be different from a parts catalog, for example. Is there a certain project youā€™ve already set up (or want to set up)? Happy to take a look there if you want to share the URL (or just some details) with us?

In general, I would usually start just by brainstorming through the project, and maybe drawing a rough outline / Venn diagram / relationships table on a whiteboard or piece of paper. Letā€™s use a simple product site as an example:

  • First, what will the user (website visitor) see on the website? Maybe a home page, some blog posts, product and pricing details, an ā€œAbout the teamā€ section, etc.

  • Some of those are relatively unique pages that have their own layout and such: The home page, pricing page, about the product. Those can be single-instance models, and may be easier to set up because thereā€™s fewer relationships.

  • Other content types, like blog posts or ā€œabout usā€ sections, might be collections of individual units of content. Each individual blog post might be its own ā€œPostā€ model, for example, linked to one or more ā€œAuthorsā€. But the actual ā€œBlogā€ index page might be its own single-instance model, with a field for a title, a introductory paragraph, and maybe an editor-curated multi-link field to the top 3 featured blog posts. (And your frontend would fetch the rest of them by date, or whatever).

    Similarly, the ā€œAuthorsā€ could be in a ā€œPeopleā€ model, with a name, profile pic, title, maybe a brief blurb. Those same people could be used as both blog post authors and team members in the ā€œabout usā€ section.

  • Then you get to some of the nitty-gritty stuff, like Blocks. A block is just a set of repeatable, reusable fields. For example, you might want a ā€œPricingā€ block that includes fields like name, description, monthly pricing, annual pricing, etc. Then you can use several of those blocks next to each other to show your different plan types.

  • Once you have all this set up, youā€™d use a combination of different GraphQL queries and filters to fetch just what you needed on each page of your frontend.

Thatā€™s just a basic example :slight_smile: If you have more details youā€™d like to share with us, or a project URL we can take a look at, we can take a deeper look and suggest something more personalized, perhaps?

1 Like