Payload CMS - How to query image content from Richtext field
Query image in Payload CMS
To query an image within Payload CMS 's Richtext field, you have to add depth
in your query.
This is how we do it within GraphQL query.
query postAll {
Posts {
docs {
slug
title
summary
body(depth: 1)
feature
}
}
}
Pay attention to the body
query, we add (depth: 1)
to enable deep query within the GraphQL, and body
is the name of the Richtext field inside the Payload CMS .