# usePageMeta
Sets the page `
` and/or `` while a component is mounted, then restores the previous values on unmount.
## Signature
```ts
function usePageMeta(params: UsePageMetaParams): void;
interface UsePageMetaParams {
title?: string;
description?: string;
}
```
| Param | Type | Description |
| ------------- | -------- | ------------------------------------------- |
| `title` | `string` | Value to set as `document.title` |
| `description` | `string` | Value to set in `` |
Both params are optional — pass only the ones you need.
## Usage
```tsx
function ArticlePage({ article }: { article: Article }) {
usePageMeta({
title: article.title,
description: article.summary,
});
return {article.content};
}
```
```tsx
// Title only
function DashboardPage() {
usePageMeta({ title: 'Dashboard' });
return ;
}
```
## Notes
- Restores the previous `document.title` and `` content when the component unmounts, so nested or sequential usage is safe.
- If no `` tag exists in the document, one is created and removed on cleanup.
- Client-only (`'use client'`). Does not run during SSR.