next 标签
From any Next.js page component, you can add information to the page header.
您可以从任何Next.js页面组件向页面标题添加信息。
This is handy when:
在以下情况下方便使用:
- you want to customize the page title 您要自定义页面标题
- you want to change a meta tag 您想更改一个元标记
How can you do so?
你该怎么做?
Inside every component you can import the Head
component from next/head
and include it in your component JSX output:
在每个组件内部,您可以从next/head
导入Head
组件,并将其包含在组件JSX输出中:
import Head from 'next/head'
const House = props => (
<div>
<Head>
<title>The page title</title>
</Head>
{/* the rest of the JSX */}
</div>
)
export default House
You can add any HTML tag you’d like to appear in the <head>
section of the page.
您可以添加任何想要显示在页面<head>
部分HTML标记。
When mounting the component, Next.js will make sure the tags inside Head
are added to the heading of the page. Same when unmounting the component, Next.js will take care of removing those tags.
在安装组件时,Next.js将确保Head
内的标签已添加到页面标题。 与卸载组件相同,Next.js将负责删除这些标记。
next 标签