From da7315f09a793301a2a27e4947810b63247a041f Mon Sep 17 00:00:00 2001 From: whn <142425816+Whning0513@users.noreply.github.com> Date: Thu, 30 Jul 2026 04:52:11 +0800 Subject: [PATCH] DOC: clarify SSR metadata hoisting for fragments --- src/content/reference/react-dom/components/title.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/reference/react-dom/components/title.md b/src/content/reference/react-dom/components/title.md index 9e4d8e65ae4..239f9c77419 100644 --- a/src/content/reference/react-dom/components/title.md +++ b/src/content/reference/react-dom/components/title.md @@ -38,6 +38,8 @@ To specify the title of the document, render the [built-in browser `` com React will always place the DOM element corresponding to the `<title>` component within the document’s `<head>`, regardless of where in the React tree it is rendered. The `<head>` is the only valid place for `<title>` to exist within the DOM, yet it’s convenient and keeps things composable if a component representing a specific page can render its `<title>` itself. +When using server rendering for only a fragment of a document (for example, rendering into a `<div id="root">`), React cannot move the `<title>` into the actual HTML `<head>` in the server response. For metadata that must be present in the initial HTML, render it in your server-side document template as well. + There are two exception to this: * If `<title>` is within an `<svg>` component, then there is no special behavior, because in this context it doesn’t represent the document’s title but rather is an [accessibility annotation for that SVG graphic](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title). * If the `<title>` has an [`itemProp`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemprop) prop, there is no special behavior, because in this case it doesn’t represent the document’s title but rather metadata about a specific part of the page.