[英]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.我正在为 web 应用程序使用
"next": "^12.2.3"
、 "react": "^18.2.0"
和"typescript": "^4.7.4"
。
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.如果我在
next.js
中使用 SSR 模式,我只看到纯 HTML 中的元标记,但 javascript ZA8CFDE6331BD59EB26696 其他所有内容。 This is not readable/seo friendly for the search engines)这对于搜索引擎来说是不可读/对 seo 不友好的)
If I use the next export
, I can see the pure HTML (readable from any search engine)如果我使用
next export
,我可以看到纯 HTML (可从任何搜索引擎读取)
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?所以,或多或少,这里的问题是:是否有任何方法可以获得 SSR 甚至 SSG 或增量 SSG,并且客户端/浏览器中的源代码是纯 HTML?
Neither next dev
nor next build
generate SPA bundles, both of them generate SSR'd HTML, <h1>...</h1>
and so on. next dev
和next build
都不会生成 SPA 包,它们都生成 SSR 的 HTML、 <h1>...</h1>
等等。 The only runtime script you are seeing is the hydration logic .您看到的唯一运行时脚本是水合逻辑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.