svrjs-nextjs-website/lib/sanity.ts

16 lines
413 B
TypeScript
Raw Normal View History

2024-08-08 11:21:56 +02:00
import { createClient } from "next-sanity";
import imageUrlBuilder from "@sanity/image-url";
export const client = createClient({
apiVersion: "2023-05-03",
dataset: "production",
projectId: `${process.env.SANITY_PROJECT_ID}`,
useCdn: false, // basically enable this for faster loading time
});
const builder = imageUrlBuilder(client);
export function urlFor(source: any) {
return builder.image(source);
}