Head / head
Methanol 为每个 .mdx 页面预置了 Head 组件(别名:head),无需显式导入即可直接使用。
在 Head 组件中渲染的内容将自动聚合,并注入到最终 HTML 的 <head> 标签内(需确保主题已渲染 <ExtraHead />;默认主题已内置此逻辑)。
使用示例
<Head>
<meta name="description" content="My page description" />
<link rel="canonical" href="https://example.com/docs/page" />
</Head>
自动注入的静态资源
Methanol 还会根据约定自动将以下资源注入 <head>:
pages/style.css(若存在)pages/index.js/pages/index.ts(若存在)- 与页面同名且同目录的专属 CSS/JS/TS 资源(例如
guide.mdx→guide.css,guide.js,guide.ts等)