Creating download URLs for files in block-content using GraphQL in Sanity
_rawContent(resolveReferences: { maxDepth: 20 })query allPage { allPage{_id
slug{current}
title
navigationtitle
bodyRaw
}
}
Where should i put maxDepth?
I have only used graphql from Sanity with gatsby, and the gatsby sanity plugins give new names to some fields, so I may have differently named fields
@sanity/asset-utils
_const_ parts = parseAssetId(_file_.asset._ref);_const_ url = buildFileUrl(parts, options);But it seems like that is exactly what you do with asset utils as well
🙂
Was this answer helpful?
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.