繁体   English   中英

如何使用reactjs覆盖og:url元标记

[英]How to override the og:url meta tag with reactjs

我是ReactJs的新手,正在一个使用react-document-meta生成元数据的网站上工作。 我想覆盖og:url标记,并且想知道是否有一种方法可以做到这一点。 作为ReactJs的新手,我想不出一种看库的方式。 感谢您的帮助。

谢谢,-DJ

基于文档源代码

const meta = {
  title: 'Some Meta Title',
  description: 'I am a description, and I can create multiple tags',
  canonical: 'http://example.com/path/to/page',  // this will be doubled as og:url
  meta: {
    charset: 'utf-8',
    name: {
      keywords: 'react,meta,document,html,tags'
    },
    property : {
      'og:url' : 'http://example.com/overriden_url' // but here you can override the autogenerated og:url
    }
  }
};

请记住,仅当在服务器端进行渲染时才有意义,因为在客户端(在浏览器中)设置meta属性不会影响在抓取页面时Facebook解析器看到的内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM