diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index 6b02da5a2..73652f949 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -1,14 +1,18 @@ import type { MetadataRoute } from "next"; import { client } from "../../studio/lib/client"; import { Slug } from "../../studio/lib/payloads/global"; +import { token } from "../../studio/lib/token"; interface SitemapDocument { slug: Slug; _updatedAt: string; } +const clientWithToken = client.withConfig({ token }); + export default async function sitemap(): Promise<MetadataRoute.Sitemap> { - const documents = await client.fetch<SitemapDocument[]>(`*[defined(slug)]`); + const documents = + await clientWithToken.fetch<SitemapDocument[]>(`*[defined(slug)]`); return documents.map((s) => ({ url: new URL(s.slug.current, process.env.NEXT_PUBLIC_URL).toString(),