You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/0.react/head/guides/1.core-concepts/1.components.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,24 @@ Google does not set a fixed meta-description length; search snippets are truncat
80
80
</Head>
81
81
```
82
82
83
+
### Raw HTML
84
+
85
+
`<Head>` supports React's `dangerouslySetInnerHTML` prop on `<title>`, `<script>`, `<style>`, and `<noscript>`. It cannot be combined with children.
86
+
87
+
Use a string child for ordinary inline scripts and styles. Use `dangerouslySetInnerHTML` when the content must be parsed as raw markup, such as an HTML fallback inside `<noscript>`:
Only pass trusted or sanitized content. Untrusted HTML can introduce an XSS vulnerability. See [React's `dangerouslySetInnerHTML` guidance](https://react.dev/reference/react-dom/components/common#dangerously-setting-the-inner-html).
-`no-deprecated-props` (error, autofix): rewrites v2 property names that v3 no longer converts.
56
56
-`no-unknown-meta` (warn, autofix): suggests corrections for typos such as `og:descriptin` → `og:description`.
57
+
-`invalid-input-shape` (warn): catches wrong container shapes and head fields such as `meta` or `titleTemplate` nested inside `htmlAttrs` or `bodyAttrs`.
-`prefer-define-helpers` (off in `recommended`, on in `migration`, autofix): wraps `link` and `script` literals in `defineLink` and `defineScript` so Unhead's discriminated unions narrow correctly.
59
60
60
61
## What it can and can't see
61
62
62
-
Lint rules walk source-level calls into `useHead`, `useHeadSafe`, `useServerHead`, `useServerHeadSafe`, `useSeoMeta`, `useServerSeoMeta`, and the tag helpers `defineLink` / `defineScript`. Tag arrays inside `meta` / `link` / `script` / `noscript` / `style`keys are descended automatically.
63
+
Lint rules walk source-level calls into `useHead`, `useHeadSafe`, `useServerHead`, `useServerHeadSafe`, `useSeoMeta`, `useServerSeoMeta`, and the tag helpers `defineLink` / `defineScript`. Tag arrays inside `meta` / `link` / `script` / `noscript` / `style`and object literals inside `htmlAttrs` / `bodyAttrs` are descended automatically.
63
64
64
65
It cannot see anything that depends on the resolved tag set: cross-tag conflicts (canonical vs `og:url`), counts (too many preloads), or rendered byte budgets (meta beyond 1MB). Those checks live in the runtime [`ValidatePlugin`](/docs/typescript/head/guides/tooling/validate-plugin) and are surfaced by the [CLI](/docs/typescript/head/guides/tooling/cli)'s `validate-html` and `validate-url` commands.
65
66
67
+
Calls, identifiers, refs, and computed expressions have an unknown static shape, so this rule leaves them for runtime validation.
68
+
66
69
## Editor integration
67
70
68
71
Editors that run ESLint through the VS Code or JetBrains integration expose fixes for autofixable rules. The `numeric-tag-priority` rule also offers a suggestion for each priority alias.
0 commit comments