Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

nextjs preview ssr

default discord avatar
waterlord93last year
2

Hi, i am still a noob in both nextjs and payload.


How can i see what has been server side render on my page while i am developing locally? Some suggest disabling js, but initial document that is loaded needs js to insert html it has inside some script tag... what am i missing?


Basically i want to see only html that has been server side rendered, to make sure that my "use client" components are not hiding important content from crawlers

  • default discord avatar
    paulpopuslast year

    Modern crawlers actually do support javascript, they just wont wait around forever for your content. But in case of your usual nextjs site it's totally fine



    use client

    components aren't

    purely

    client side, it's a bit more complex than that



    but the tldr of it is that if you're fetching your data on the server side, either via your route or in a server component then you'll be 100% fine



    you can also do

    yarn build

    and then

    yarn serve

    to check out your prod build locally



    the modern web doesnt work or exist without javascript so unless you have specific requirements to run it without js (in which case you wouldnt build it with nextjs) i would worry about it too much as long as you're adhering to nextjs best practices

  • default discord avatar
    waterlord93last year

    Thank you very much for a very detailed explanation.


    I will give this a try

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.