For AI agents: the complete documentation index is available at https://rspress.rs/zh/llms.txt, the full documentation bundle is available at https://rspress.rs/zh/llms-full.txt, and this page is available as Markdown at https://rspress.rs/zh/ui/runtime-components/head.md.
close
  • 中文
  • Head

    Head 组件用于向文档页面插入自定义 head 内容(基于 unhead)。

    如果你更习惯用对象形式声明 head,或者需要基于组件状态、props 计算 head 内容,可以使用 useHead hook。

    用法

    index.mdx
    import { Head } from '@rspress/core/runtime';
    
    <Head>
      <meta property="og:description" content="Out-of-box Rspack build tools" />
      <link rel="canonical" href="https://example.com" />
    </Head>

    可在 MDX 或 React 页面中添加 meta 标签、canonical、Open Graph、favicon 等头部信息。