SSG & Auth
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Hi gang, just curious if the following scenario is possible:
A site which has a navbar loaded on all pages. The navbar contains some information that changes based on if the user is logged in or not. (based on Supabase)
Then we have some blog pages which are fully statically generated on build (SSG).
Now my question is: Is it possible to have the blog pages generated on build (SSG) while still being able to use the navbar as a component which can still check if the user is logged in or not?
or is SSR better suited for that?
Also, I assume we can't really cache these pages properly, since they use auth.
A site which has a navbar loaded on all pages. The navbar contains some information that changes based on if the user is logged in or not. (based on Supabase)
Then we have some blog pages which are fully statically generated on build (SSG).
Now my question is: Is it possible to have the blog pages generated on build (SSG) while still being able to use the navbar as a component which can still check if the user is logged in or not?
or is SSR better suited for that?
Also, I assume we can't really cache these pages properly, since they use auth.
3 Replies
West African Crocodile
ofc, navbar have to be SSR and your blog page can be SSG.
I wish it is helpful for you
I wish it is helpful for you
Transvaal lionOP
I'm just unsure how to separate the 2. The navbar is loaded via the layout file. In the blog posts I'm using generateStaticParams and export const dynamic = 'force-static' to get the html files generated but when I navigate to the blog pages, the navbar shows that I'm logged out
West African Crocodile
okay, can you share your code?