Carl Topham
Frontend JavaScript engineer
Visit Carl Topham's profile
Truncate block content into a shorter value to use as an excerpt
*[_type == "article" && draft != true ] | order(publishedOn desc)[0..5] {
"excerpt": array::join(string::split((pt::text(body)), "")[0..255], "") + "..."
}This query takes a block field and creates an excerpt of the required length so that truncation doesn't need to be done on the client side.
Frontend JavaScript engineer
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store