[英]How do I setup for Each page custom META and related Information for the Page with ReactJS Router
I'm new to ReactJS, And I have set up my new project using Router and added few pages, so my question is how can I set up different head meta and other tags for each custom page.我是 ReactJS 的新手,我已经使用路由器设置了我的新项目并添加了一些页面,所以我的问题是如何为每个自定义页面设置不同的头部元和其他标签。 And will this render by Google and show my pages to Google as normal page?
这会由谷歌呈现并将我的页面作为普通页面显示给谷歌吗?
you can set meta and other tags with react-helmet.您可以使用 react-helmet 设置元和其他标签。
Install from here https://www.npmjs.com/package/react-helmet从这里安装https://www.npmjs.com/package/react-helmet
Suggestion ->Create one component and set with props.建议 -> 创建一个组件并使用道具进行设置。
Something like this像这样的东西
import React from "react";
import {Helmet} from "react-helmet";
class Application extends React.Component {
render () {
return (
<div className="application">
<Helmet>
<meta charSet="utf-8" />
<title>My Title</title>
<link rel="canonical" href="http://example.com/" />
</Helmet>
...
</div>
);
}
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.