我目前在我的GatsbyJS项目中使用react-helmet
。我正在尝试为每个页面的标题添加标题。它正在开发中,但在我部署时不起作用。我尝试同时部署到Github Pages和Netlify都没有成功。
import React from 'react';
import Layout from '../components/Layout';
import P from '../components/designSystem/P';
import Link from '../components/designSystem/Link';
import H1 from '../components/designSystem/H1';
import Helmet from 'react-helmet';
import { siteInfo } from '../data';
const page = 'About';
export default () => (
<Layout>
<Helmet>
<title>{siteInfo.title + ' | ' + page}</title>
</Helmet>
<H1>About Me</H1>
<P>
Hi! I'm Adway. I'm currently a sophomore at Saint John's High School in
Shrewsbury, Massachusetts.
</P>
</Layout>
);
答案 0 :(得分:0)
确保在react-helmet
文件中包含gatsby-plugin-react-helmet
(gatsby-config.js
)。
module.exports = {
plugins: [
"gatsby-plugin-react-helmet"
]
};