Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/router/framework/react/guide/document-head-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,35 @@ For full-stack applications that use Start, and even for single-page application

To manage the document head, it's required that you render both the `<HeadContent />` and `<Scripts />` components and use the `routeOptions.head` property to manage the head of a route, which returns an object with `title`, `meta`, `links`, `styles`, and `scripts` properties.

## The `head` Property in Routes

You can define a `head` function inside route definitions to dynamically manage document-level metadata.

### Usage

```tsx
export const Route = createFileRoute('/')({
head: () => ({
title: 'My Home Page',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think title is not yet implemented, is it?

meta: [
{ name: 'description', content: 'Welcome to my app!' },
{ property: 'og:title', content: 'My App' },
],
links: [
{ rel: 'icon', href: '/favicon.ico' },
],
styles: [
{
media: 'all and (max-width: 768px)',
children: `body { font-size: 14px; }`,
},
],
scripts: [
{ src: 'https://example.com/script.js' },
]
}),
})

## Managing the Document Head

```tsx
Expand Down