#"Partially" pre-render page

5 messages · Page 1 of 1 (latest)

cursive tinsel
#

Hello,

I have a page in Nuxt which I would like to pre-render at build time. However, the header of my site changes based on whether a user is logged in or not. Is there a way for me to pre render the page only and not the template in Nuxt?

Thank you!

small briar
#

I haven't tried this, but can you make those components which depend on the user's logged-in state to be client-only?

#

Even if they are "prerendered" if you have the state update using onMounted to load the user's profile picture, for example, it might still work fine.

#

We've done completely SSG sites which have user-specific data on them. https://americanbookcompany.com/ is one example of this. It's a totally SSG site with no running Nuxt server at all. Users can log in and see their profile information, order history, etc. The top nav changes based on their logged-in state because the component updates when it's mounted.

#

Every page is prerendered, including all the individual product pages, list views, etc