我使用react js和react-helmet来更改页面中的规范标记值。但是,它并没有更新值。它到处都显示https://www.example.com,这在我的index.php文件中提到过。我需要更新规范链接。我之前使用过jquery,但它不起作用。它是在element-inspector中更新的,而不是在page-source中更新的,但谷歌将其标记为重复页面。
我在关注https://github.com/nfl/react-helmet#server-usage
canonical url code
var newCanonicalUrl = "https://www.examle.com" + this.state.productUrl;inside render function
return(<Helmet link = {[{"rel" : "canonical", "href" : {newCanonicalUrl}}]}>);发布于 2017-07-07 01:46:47
这应该能起到作用:
link = {[
{ rel : 'canonical', href : newCanonicalUrl }
]}https://stackoverflow.com/questions/40903797
复制相似问题