我目前在我的GatsbyJS项目中使用react-helmet。我正在尝试为每个页面添加标题,在标题中。它在开发中工作,但在我部署时不起作用。我已经尝试部署到Github页面和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>
);发布于 2019-02-13 07:12:50
确保在gatsby-config.js文件中包含react-helmet (gatsby-plugin-react-helmet)。
module.exports = {
plugins: [
"gatsby-plugin-react-helmet"
]
};https://stackoverflow.com/questions/54642256
复制相似问题