Products -> Product Detail : need help to get the right detail

Hi,
I’ve followed the video Headless Strapi Integration - Divhunt No-Code Web Builder - YouTube
I’ve got a similar use case with Products page with links to ProductDetail page
I still don’t get how to get the detail for the product selected into the Products page.
I’m missing something but can’t figure out.

I’ve created the ProductDetail page with src Product & define route as /productdetail/:name
I’m using the variable Page->Data to display information

In Products page, into the link I’ve added a Route variable to set name

@xmasrock

Can you try using route /productdetail/:slug or /productdetail/:id ?

In most systems, single pages are created by using either id or slug, so using anything else like name is not possible to for Strapi to find that record.

However, with Divhunt you can still use name in route, as long as you have id or slug included, for example:

/productdetail/:slug/:name

Thanks @dejan , it works with id.
I don’t want Content writers to deal with slugs.

@xmasrock

For SEO purpose if your posts have name I would suggest using as following

/productdetail/:id/:name

Then in Advanced tab set ID as you already did, and set name to name but add function ->slug this will convert name to slug for URL.

So you will end up with /productdetail/some-id/this-is-name-of-post.

1 Like