diff --git a/docs/02-app/02-api-reference/05-next-config-js/images.mdx b/docs/02-app/02-api-reference/05-next-config-js/images.mdx index e735b0dafe006..d77e4773b6f66 100644 --- a/docs/02-app/02-api-reference/05-next-config-js/images.mdx +++ b/docs/02-app/02-api-reference/05-next-config-js/images.mdx @@ -47,6 +47,7 @@ Alternatively, you can use the [`loader` prop](/docs/pages/api-reference/compone - [ImageEngine](#imageengine) - [Imgix](#imgix) - [Thumbor](#thumbor) +- [Sanity](#sanity) - [Supabase](#supabase) ### Akamai @@ -153,6 +154,24 @@ export default function thumborLoader({ src, width, quality }) { } ``` +### Sanity + +```js +// Docs: https://www.sanity.io/docs/image-urls +export default function sanityLoader({ src, width, quality }) { + const prj = 'zp7mbokg' + const dataset = 'production' + const url = new URL(`https://cdn.sanity.io/images/${prj}/${dataset}${src}`) + url.searchParams.set('auto', 'format') + url.searchParams.set('fit', 'max') + url.searchParams.set('w', width.toString()) + if (quality) { + url.searchParams.set('q', quality.toString()) + } + return url.href +} +``` + ### Supabase ```js