Explaining self-referencing category array without category name field

13 replies
Last updated: Jan 16, 2026
could you explain your schema a little bit it seems like categories is self referencing array but there is no value like Category name etc...?
AI Update

It sounds like you're looking at a schema where there's a categories field defined as an array, but it's not clear what's actually being stored in it. Let me help clarify what might be happening!

Based on your description, it seems like you have a self-referencing array, which typically means an array of references that point back to the same document type. However, you're right to be confused if there's no clear "Category name" or other identifying fields visible.

Common Patterns & What Might Be Going On

Self-Referencing Array Pattern

A typical self-referencing categories array might look like this in your schema:

{
  name: 'categories',
  type: 'array',
  of: [
    {
      type: 'reference',
      to: [{type: 'category'}]
    }
  ]
}

This would reference separate category documents. If you're not seeing category names, you might need to check:

1. The referenced document type - Look for a separate category schema definition that should have fields like:

{
  name: 'category',
  type: 'document',
  fields: [
    {
      name: 'title',
      type: 'string',
      title: 'Category Name'
    }
    // ... other fields
  ]
}

2. The preview configuration - The preview property determines what you see in the Studio. If it's missing or misconfigured, you might not see the category names displayed properly. You can add a preview configuration to make the category names visible:

preview: {
  select: {
    title: 'title'
  }
}

Alternative: Inline Objects

If it's truly self-contained (not references), it might be an array of objects:

{
  name: 'categories',
  type: 'array',
  of: [
    {
      type: 'object',
      fields: [
        {
          name: 'name',
          type: 'string',
          title: 'Category Name'
        }
      ]
    }
  ]
}

Troubleshooting Steps

Without seeing your actual schema code, here's what to check:

  1. Look for a separate category document type in your schema files
  2. Check if the preview configuration exists on that category type
  3. Verify the of property in your categories array has the correct type reference
  4. Make sure the referenced type has actual content fields like title, name, etc.

As mentioned in the array fields documentation, arrays need a valid of property that defines what types they contain, and each member type should have appropriate fields to display meaningful content. The array itself is just a container - the actual data structure comes from what you define in the of array.

If you can share the schema definition for both the categories field and any related category document type, I can give you more specific guidance on what might be missing!

Show original thread
13 replies

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?