How to query author bio raw text field in Sanity GraphQL?

4 replies
Last updated: Jan 28, 2026
Hello, I am struggling to get the author bio raw text to populate return from my blog post template query. Query looks like this:
  query BlogPostTemplateQuery($id: String!) {
    post: sanityPost(id: { eq: $id }) {
      id
      publishedAt
      categories {
        _id
        title
      }
      mainImage {
        ...SanityImage
        alt
      }
      title
      slug {
        current
      }
      _rawExcerpt(resolveReferences: { maxDepth: 5 })
      _rawBody(resolveReferences: { maxDepth: 5 })
      authors {
        _key
        author {
          image {
            crop {
              _key
              _type
              top
              bottom
              left
              right
            }
            hotspot {
              _key
              _type
              x
              y
              height
              width
            }
            asset {
              _id
            }
          }
          name
          bio 
        }
      }
    }
  }
`;
And the error I’m getting is:

There was an error in your GraphQL query:

Field "bio" of type "[SanityBlock]" must have a selection of subfields. Did you mean "bio { ... }"?
But I cannot find any of the fields that are defined for ‘bio’ in any documentation. In the GraphQL playground, these are bioRaw and return an array of objects but none of the rawContent, rawBody, or raw Excerpt fields are working. Any help would be greatly appreciated!
AI Update

Based on your error and the context, the issue is that bio is a Portable Text field (type [SanityBlock]), which requires you to query its subfields in GraphQL. However, what you actually want is the _rawBio field that's specific to gatsby-source-sanity.

The _raw fields (like _rawBio, _rawBody, _rawExcerpt) are special fields generated by gatsby-source-sanity that aren't available in Sanity's standard GraphQL playground. This is why you're having trouble finding documentation about them in the regular Sanity docs - they're Gatsby-specific!

Here's how to fix your query:

query BlogPostTemplateQuery($id: String!) {
    post: sanityPost(id: { eq: $id }) {
      id
      publishedAt
      categories {
        _id
        title
      }
      mainImage {
        ...SanityImage
        alt
      }
      title
      slug {
        current
      }
      _rawExcerpt(resolveReferences: { maxDepth: 5 })
      _rawBody(resolveReferences: { maxDepth: 5 })
      authors {
        _key
        author {
          image {
            crop {
              _key
              _type
              top
              bottom
              left
              right
            }
            hotspot {
              _key
              _type
              x
              y
              height
              width
            }
            asset {
              _id
            }
          }
          name
          _rawBio(resolveReferences: { maxDepth: 5 })
        }
      }
    }
  }

The key change is replacing bio with _rawBio(resolveReferences: { maxDepth: 5 }). This will give you the raw Portable Text content as an array of block objects, just like your _rawExcerpt and _rawBody fields.

The resolveReferences parameter is important if your bio content contains references to other documents - it tells Gatsby how deeply to resolve those nested references. This matches the pattern you're already using successfully for _rawExcerpt and _rawBody.

Show original thread
4 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?