Contentful logo

Contentful Community

Modelling navigation & content views

#1

I’m following the approach of modelling navigation outlined here where I have content types of:

  • Navigation
    • Title (short text): Title to use in Nav
    • Slug (short text): To build URL
    • Page Content (one-to-one reference): The content to display for the page itself
    • Parent (one-to-one reference): The parent of the current Nav item (only blank for the homepage)

For the Page Content field I have only allowed a number of different page-level “template” content types (e.g. News page, Generic content page, Landing page)

This is working quite well to allow us to use single API requests to:

  1. From the root page ID, build out the site menu structure
  2. From the ID of an individual piece of content, build out it’s “friendly URL” by traversing up the menu structure.

To support editors though, I’d like to add two views, to:

  1. Find “orphan” pages that don’t have a matching “navigation” entry — the “pseudo-filter” I want would be “Content-type: ‘News’ or ‘Generic’ or ‘Landing’ and ‘inbound links’ = none”
  2. Find “navigation” entries that don’t have a parent (so are detached from the site tree) — e.g. “Content-type: ‘Navigation’ and parent = null”

Is it possible to do either of these types of queries? Or is there a better way to structure the content? Maybe I’m coming at this with a mindset of a ‘traditional’ tree structure in a CMS so I’m overlooking a better way to arrange the content.

Thanks!
Dave

0 Likes