Next.js Discord

Discord Forum

Page.tsx can't prerendered as SSG

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Avatar
Sun bearOP
hello, I have a problem with the rendering of the root page ("/") which is not rendered in SSG but in static which prevents revalidation when the data sent from my CMS changes. I try to export the revalidation directly every 5 seconds but it still makes a static file. I also export dynamically but it makes the page loading quite long because I have a lot of data and I want to keep this cache feature revalidated. Thank you in advance for your answers that will relieve me of 2 days of suffering:/

export const revalidate = 5;

async function Home() {
  const [posts, categories, videos, highlightedPosts, topPosts] =
    await Promise.all([
      getPosts(),
      getCategories(),
      getLatestYoutubeVideos(),
      getPostsByCategory("a-la-une"),
      getTopViewPosts(),
    ]);

  return (
    <main className="main">
      <Landing posts={highlightedPosts} />
      <RecentArticles posts={posts} />
      <PopularArticles posts={topPosts} />
      <CategoriesList categories={categories} />
      <Videos videos={videos} />
    </main>
  );
}

export default Home;
Image

0 Replies