Sharing on social media, the URL does not render any meta data

后端 未结 3 1494
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 21:25

We have built a project (Web Application) in React .net core using react in client-side rendering.

We\'ve used react-helmet for dynamically assigning meta tags.

3条回答
  •  鱼传尺愫
    2020-12-01 21:47

    Prerender is the only solution. I used a node dependency called "prerender" -> https://github.com/prerender/prerender

    It works enabling a web server wich make http requests. Assigning value to a boolean: window.prerenderReady = true; in your website tells your server when the page is ready to "take the photo" and it returns the Html when so. You need to program an easy script that parses all the site urls and save those html contents to files. Upload them to your server and using .htaccess or similar target the crawlers external-hit-facebook,twitterbot,googlebot, etc.. to show them the prerendered version and 'the real site' to the rest of user-agents.

    It worked for me.

提交回复
热议问题