#Error occurred prerendering page "/sitemap.xml"

5 messages · Page 1 of 1 (latest)

limpid steppe
#

i have this inside app/sitemap.ts

import { getData } from "@/lib/meta";
import { Blog } from "@/utils";

export default async function sitemap() {
  const posts = await getData();
  const baseUrl = "https://enigma.fm";

  const postUrls = posts.map((post: Blog) => ({
    url: `${baseUrl}/community/blogs/${post.slug.current}`,
    lastModified: new Date(post.publishedAt),
  }));
  const uniqueAuthors = new Set(
    posts.map((post: Blog) => post.author.slug.current)
  );

  const authorUrls = Array.from(uniqueAuthors).map((authorSlug) => ({
    url: `${baseUrl}/community/author/${authorSlug}`,
    lastModified: new Date(),
  }));

  return [
    {
      url: baseUrl,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/pricing`,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/profile`,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/signup`,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/signin`,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/success`,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/privacy`,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/refund`,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/terms`,
      lastModified: new Date(),
    },
    {
      url: `${baseUrl}/community`,
      lastModified: new Date(),
    },
    ...postUrls,
    ...authorUrls,
  ];
}

i was trying to dynamically generate sitemaps with the help of the docs from next js, so the sitemaps are perfectly fine on development but it gives this error while i try to deploy it to the vercel

vale heraldBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

limpid steppe
#

please atleast help me out with this one

limpid steppe
#

Guys anyone?

limpid steppe
#

wow no one gonna respond ?