✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Using @sanity/asset-utils to load SVGs in Next.js

8 replies
Last updated: Jun 7, 2023
Can we tell GROQ to format SVG to JPG? Sanity Url image builder doesn’t like svgs in nextjs.
Jun 7, 2023, 12:13 AM
format xml into byte data? no. whats the issue you’re having?
Jun 7, 2023, 12:30 AM
Using the Sanity image urlBuilder wont load svg’s inside my next js application
Jun 7, 2023, 12:31 AM
pretty sure you just need to use the assetUrl helper
Jun 7, 2023, 12:32 AM
I cant remember what its called
Jun 7, 2023, 12:32 AM
@sanity/asset-utils
Jun 7, 2023, 12:38 AM
either
buildFileUrl()
or
getFileAsset()
Jun 7, 2023, 12:39 AM
Thanks Parker! i will check this out 👍 🙏 :saluting_face:
Jun 7, 2023, 12:40 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?