> For AI agents: the complete documentation index is available at https://rspress.rs/llms.txt, the full documentation bundle is available at https://rspress.rs/llms-full.txt.

# useFrontmatter

`useFrontmatter` returns the [frontmatter](https://rspress.rs/api/config/config-frontmatter.md) of the current page in a convenient object.

- **Type:** `() => { frontmatter: FrontMatterMeta }`

Example: render a custom badge when the page is marked as `beta` in frontmatter.

```tsx
import { useFrontmatter } from '@rspress/core/runtime';

export default function BetaBadge() {
  const { frontmatter } = useFrontmatter();
  return frontmatter.beta ? <span>Beta</span> : null;
}
```

> Combine with [`usePage`](https://rspress.rs/ui/hooks/use-page.md) when you also need other page metadata (title, route, toc, etc.).
