1

I have deployed reactjs as theme to wp. Now I have question about SEO configuration for react-routes. If I use wordpress (headless) as backend and reactjs as client side. Should I make reactjs server-side or there are more ways to solve SEO problem.

I also used react-helmet but it's only makes titles and content while visiting site not like when sharing facebook or google search.

Which is the best way to solve it.

  • Keep in mind that questions need to be answerable in a concrete manner, this isn't a discussion forum. The create react wptheme just generates a react scaffold, it doesn't create a WP theme, so it's not clear what you mean by configuring SEO. If it's how to get Yoast SEO working with your React code, that's a Yoast SEO question and offtopic here. Please edit your question to a specific thing – Tom J Nowell Dec 12 '19 at 21:50
  • I edited my question now – Shark Dec 12 '19 at 22:08
  • hmm I think I have misunderstood what the create-react-wptheme is, this isn't a WP site at all but a standalone React application that talks to and interacts with WordPress, it is not a WP theme. This is as close to WP as a native mobile app that talks to a WP site, WP knowledge will be of extremely limited use to you here, and none of the plugins will do anything for you as they assume a PHP generated standard WP theme. Keep in mind the instructions you follow are not official WP instructions, and there is no official WP react headless theme or standard – Tom J Nowell Dec 13 '19 at 0:48
0

Which is the best way to solve it.

There is no WP based solution to solve this. Any WP solutions will modify the output of a WP theme, but you don't have a WP theme. What you have is a React web application that talks to a REST API and gives the appearance of a WP frontend.

To be clear, your React frontend is not a WordPress site, and it is not a WordPress theme. It's a pure JS frontend built in React that grabs content from an API.

You can ingest data from WordPress, but generating SEO tags, making your markup search engine friendly, that's a pure React problem that has little or nothing to do with WordPress. There is no way for plugins to change your apps header tags, or other things.

This is one of the costs of going headless, you need to implement this yourself. As such, you can't just add seo. Instead, you need to research what these plugins do, and reproduce it independently, or via libraries from the JS community.

Consequently, you'll need to understand what it is that needs to be done, and there won't be a 1 size fits all solution. You won't find a JS library that does all the things you need, and will need to implement various things independently.

WP resources and communities will be of limited value as a result.

|improve this answer|||||
  • But how is this possible that all wp posts,adverts etc. URL endpoints that are like: Permalink: example.com/news/some-news-for-example And now if I search or share on facebook I'll get the title and everything fine. But the problem starts with routes that has link different form permalink example.com/eng/news/some-news-for-example Is there any solution inside wp to redirect url or change .htaccess or. I'm new with wordpress and that's why I ask stupid questions. – Shark Dec 14 '19 at 5:11
  • HTAccess and WP redirects etc all work in Apache/PHP, both of which you are no longer using. What you've done is not WP, and 99.9999% of WP resources and documentation are now irrelevant to you. Facebook isn't interacting with WP, it's interacting with a static page that has a React application on it. Other than a connection to the REST API no WordPress is involved. As for why some routes show up good in FB, and some don't, that would depend on how your react application is built, which is again, not a WordPress problem, and doesn't have a WordPress solution. – Tom J Nowell Dec 15 '19 at 12:08
  • Just to reiterate, your React based headless frontend, is not WordPress. There are no WordPress plugins or rewrite rules, you chose to use React router instead. Any opengraph tags that are or aren't there are being generated by your React app, not WordPress. WP won't be sending any SEO tags via the REST API, that's all done in your Javascript – Tom J Nowell Dec 15 '19 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.