I am using Link inside components to go different pages like
<Link to={'/documents/' + x.id}></Link
However, this causes SEO problems as the meta tags are not refreshing when a page changes. I am also using Server Side Rendering.
What would be the right way to use Link to still have fluent page changes and still have SEO optimizations.
Thanks
2
Answers
Thank you @luiz-mariz, I am already using react-helmet but the problem was that I was getting the page information in
componentDidMount()
however when I do this, the information is not read by the crawlers because they won't wait for API call to pass down information about the content. That was my mistake.The way I solved it was using getting the specific page information and before page is loaded (using Server Side Rendering) and then passing that information onto the App component.
Also, I have added some more tags to the react-helmet component. Might be useful for some people who want to use facebook or twitter sharing capabilities.
Personally i use to create a SEO component in my projects to avoid problems. I also like to use react-helmet, wich will manage all changes to the
<head/>
For example:
So, import it in each page with the desired props
Hope it helps.