cra-ssr-code-splitting icon indicating copy to clipboard operation
cra-ssr-code-splitting copied to clipboard

How to support dynamic meta tags which are asynchronously resolved

Open Amila-Rukshan opened this issue 5 years ago • 0 comments
trafficstars

So far I managed to adapt this boilerplate code for my project. Now I need to support dynamic meta tags for some routes. These components receive the meta tags using an API call to the server. Actually meta tags are set and viewable via inspecting the browser. But Facebook sharing debugger only reads the static meta tags.

<Helmet>
         <title>{this.state.firstName+' '+this.state.lastName}</title>
         <meta name="og:description" content={this.state.description+" this is my profile"} />
         <meta property="og:image" content={"/images/share/home page share.jpeg"}
</Helmet>

state values are set by an API call inside the component. In the above example og:image is set as it is static. og:description only has static portion after scraped by facebook sharing debugger. Am I missing some step? data to be set meta tags are loaded in compnentWillMount life cycle.

Amila-Rukshan avatar Jun 21 '20 07:06 Amila-Rukshan