How to update meta tags in React.js?

后端 未结 9 851
清酒与你
清酒与你 2020-12-28 12:05

I was working on a single page application in react.js, so what is the best way to update meta tags on page transitions or browser back/forward?

9条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 12:58

    Not sure if this is the answer you were looking for but I was searching for how to update the info your react app shows when you preview the link in some other app. Every solution I tried wasn't working with github pages and react (react-helmet, react-meta-tags, react-document-meta). What ended up working was that you can edit the index.html located inside the public folder to change this info. Include this somewhere in the head:

    
    
      
        
        
        
        
        IMDB
        
        
        
        
        
        
        
        
    

    Example from https://ogp.me/

提交回复
热议问题