πŸ‘€ See Sanity in action: Watch product demo now β†’

URL Structure - Is it Possible to Combine Different Page Types Under the Same Root?

3 replies
Last updated: Jun 18, 2020
Hi I need a little help with structure builder. Is it possible to combine different types under same root for example I have articlePage, landingPage and I want them both under "Pages" folder in sanity and then I want to have root "Globalconfig" where I plan to add pages that are related to site settings like navigation, global settings etc?
Jun 18, 2020, 9:02 AM
Yes you can, here is a gist
Jun 18, 2020, 9:20 AM
and then in my main
index.js
file I have something like this:
import S from "@sanity/desk-tool/structure-builder"
import page from "./page"
import links from "./links"
import siteSettings from "./site-settings"

const hiddenDocTypes = listItem =>
  !["projects", "vimeo", "info", "siteLinks", "siteSettings"].includes(
    listItem.getId()
  )

export default () =>
  S.list()
    .title("Content")
    .items([
      page,
      ...S.documentTypeListItems().filter(hiddenDocTypes),
      links,
      siteSettings,
    ])
Jun 18, 2020, 9:21 AM
user T
Thanks a lot
Jun 18, 2020, 10:05 AM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in