Static pre-rendering with server components
Unanswered
Kerry Beagle posted this in #help-forum
Kerry BeagleOP
(tl;dr at bottom)
Hi all,
Quick question: I have a website which has a bunch of user pages that use a dynamic route segment (
These API calls are expensive, and in the app router, I want to be able to statically pre-render (on the server, for seo purposes) the top 100 user pages. The rest can be rendered on demand, but the top 100 must be cached for speed purposes.
I know I can use the
So how can I accomplish the static pre-rendering?
TL:DR; have a bunch of user profiles (dynamic route segment). for logged out users, the top 100 (by traffic) must be static and pre-rendered, but for logged in users, it can be dynamic. it uses next/cookies to determine if the user is logged in. How can I make this work?
Hi all,
Quick question: I have a website which has a bunch of user pages that use a dynamic route segment (
/users/[slug]). they share a layout and all are dynamically populated from an API.These API calls are expensive, and in the app router, I want to be able to statically pre-render (on the server, for seo purposes) the top 100 user pages. The rest can be rendered on demand, but the top 100 must be cached for speed purposes.
I know I can use the
generateStaticParams function to pre-render these pages, but these pages depend on next/cookies to check if the user is logged in and return a different interface if they are.So how can I accomplish the static pre-rendering?
TL:DR; have a bunch of user profiles (dynamic route segment). for logged out users, the top 100 (by traffic) must be static and pre-rendered, but for logged in users, it can be dynamic. it uses next/cookies to determine if the user is logged in. How can I make this work?