-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsanity.js
More file actions
18 lines (15 loc) · 696 Bytes
/
Copy pathsanity.js
File metadata and controls
18 lines (15 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { createClient } from 'next-sanity';
import createImageUrlBuilder from '@sanity/image-url';
export const config = {
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET || 'production',
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
apiVersion: '2022-11-16',
useCdn: process.env.NODE_ENV === 'production',
};
// Set up the client for fetching data in the getProps page functions
export const sanityClient = createClient(config);
/**
* Set up a helper function for generating Image URLs with only the asset reference data in your documents.
* Read more: https://www.sanity.io/docs/image-url
**/
export const urlFor = (source) => createImageUrlBuilder(config).image(source);