Attach arbitrary home pages to models

Problem

It’s a common arrangement that:

  • You have a model, e.g. services, which has every service type.
  • On the actual website, you have a top-level Services page, with some text, which lists all of the service records.
  • You have a separate pages model, which has one record for each of those top-level pages, where the top-level text can be edited – or, you have a single-instance services_home model.

Currently in Dato there is no elegant way to view and edit the top-level home page text in context with the individual records for a given model. In the example above, we cannot edit everything about Services together in one section.

At present:

  • You can create a Menu item called Services, which lists every service record.
  • You can create a Menu item called Pages, which lists every page record.
  • You cannot have a single Menu item called Services which lets you edit the Services home page text in context, then drill down to the individual service records.

Proposal

Under a model’s Additional settings, allow the specification of a single record which is considered its Home page.

This could be implemented with options something like:

  1. Home page? (boolean) (“Does this model have a home page?”)
  2. Model (select a model) (“In which model can the home page be found?”)
  3. Record (record selector) (selects a record from the chosen model)

Once a model has a specified record as its Home page, the effect is as follows:

If that model is tied to a Menu item, then when the user clicks that Menu item:

  • The first record at the top of the view (separated out) is the selected Home page record. Clicking this presents the appropriate editor for that model.
  • Below this are all the records of the model as normal

As a workaround, you can add a menu item that links to the URL of an specific pages record, e.g. https://yourproject.admin.datocms.com/editor/item_types/12345/items/67890/edit

Even though the menu editor UI says “external URL”, it actually works totally fine with another Dato URL. And in fact it’ll navigate there clientside, instantly, without a reload.

Then you can drag that workaround menu entry wherever you want, like nesting it under the services menu entry.

1 Like

@roger’s suggestion is good, or otherwise you can have the Services page that links all the services, so that you have a page with a description and a list of services that are published?

Thanks @roger that’s a great workaround, although I’m wary that it’s a kind of hack. It feels to me like this is a really core use case.

The other workaround is to create a Menu like:

  • Services [ = services_home single-instance ]
    • Services List [ = services model ]

It works but it would be much more elegant just to have a single Menu item.