Conditional SSG #12470
-
Is it possible to conditionally access SSG content? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
SSG constructs pages at build time, so it wouldn't know about any kind of user data or authentication. So as far as I know, no, this isn't possible to SSG a user-specific bit of content (at least, not if it requires authentication). It might be worth looking into how the Vercel folks have implemented SSG for their dashboard views: basically each internal page can load an SSG'd "skeleton" of the page. Once it mounts on the client, user access is validated and either populates the content of the skeleton, or redirects out to a login page. |
Beta Was this translation helpful? Give feedback.
SSG constructs pages at build time, so it wouldn't know about any kind of user data or authentication. So as far as I know, no, this isn't possible to SSG a user-specific bit of content (at least, not if it requires authentication).
It might be worth looking into how the Vercel folks have implemented SSG for their dashboard views: basically each internal page can load an SSG'd "skeleton" of the page. Once it mounts on the client, user access is validated and either populates the content of the skeleton, or redirects out to a login page.