简体   繁体   中英

SSR Next.js don't provides plain HTML, but JS

I am using "next": "^12.2.3" , "react": "^18.2.0" , and "typescript": "^4.7.4" for a web app.

If I use SSR mode in next.js , I see only the metatags in pure HTML, but a javascript object wraps all the other content. This is not readable/seo friendly for the search engines)

If I use the next export , I can see the pure HTML (readable from any search engine)

So, more or less, the question here is: if there is any way to have SSR or even SSG or Incremental SSG, and the source code in the client/browser to be pure HTML?

Neither next dev nor next build generate SPA bundles, both of them generate SSR'd HTML, <h1>...</h1> and so on. The only runtime script you are seeing is the hydration logic .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM