Reputation: 119
I have a Nextjs project where I want to show a Wordpress page on some of the pages. So for example on this route products/[id]
I want to show a wordpress page that contains info related to that product below the main info. This is needed because for some of the designs we are using Divi.
At the moment the only solution I came up with was using and iframe to show the page (it works), but it feels a bit hacky and it's probably not the best solution. Is there a better way to do it? Thanks.
Upvotes: 0
Views: 562
Reputation: 603
You can use REST API of WordPress to show product details in your NextJS project.
You can use gien endpoint for getting product details.
site_url/wp-json/wp/v2/posts/{product_id}/
and can create folders like products/[id]
for routing in NextJS.
That will makes these pages fast and also helpful in SEO.
Upvotes: 0