Query examples
Query examplesMenus

Menus

These are examples of queries to fetch menu data.

Fetching menus

Fetch a specific menu, and the raw data of its entries:

{
  menu(by: { id: 176 }) {
    itemDataEntries
  }
}

Fetch all menus, nesting queries to select the properties from the items:

{
  menus {
    id
    name
    slug
    count
    locations
    items {
      ...MenuItemProps
      children {
        ...MenuItemProps
        children {
          ...MenuItemProps
        }
      }
    }
  }
}
fragment MenuItemProps on MenuItem {
  classes
  description
  id
  objectID
  parentID
  target
  title
  url
}

Filtering and paginating menus:

{
  menus(pagination: { limit: 1, offset: 1}, filter: { search: "all" }) {
    id
    name
    slug
  }
  menuCount(filter: { search: "all" })
}