"Partially" pre-render page

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!
3 Replies
Smef
Smef7mo ago
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.
Smef
Smef7mo ago
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.
ABC Home Page
American Book Company is your home for an expansive resource providing detailed, powerful, and specific educational and test prep content for state and national curriculum for your needs in the classroom and tutoring along with online testing that is accessible on all devices.
Smef
Smef7mo ago
Every page is prerendered, including all the individual product pages, list views, etc The components, like the top nav, use local state or Pinia to determine if the users are logged in or not, and to change the content
Want results from more Discord servers?
Add your server