Route Masking Scenario
Answered
Australian Freshwater Crocodile posted this in #help-forum
Australian Freshwater CrocodileOP
Hello, I have run into some concerns about routing different product pages through id linking of an e-commerce app.
Basically, on a route that shows products ie. /shop. Without an id present on the route path, the app will just fetch a list of products.
However, what if I wanted the products fetched to be from a certain category, /shop/:category
ie /shop/mens or /shop/backpacks.
I could use the category name to query my inventory management platform, but with my specific platform used, It seems it would be better to retrieve items from a specific category id than name, such as /shop/
Updated Question
The same thing with products that I have run into.
I share urls on facebook to that lead to this route
/shop/product/[productId]/page
Easily find product data in db through id and just show data on page.
Though venturing into seo, it seems using descriptive urls is the way to go.
So how would this work in nextjs?
Using the same route I would grab the id and find product but would I jus redirect to new page just to show the same data but a different url resulting in /shop/product/all-new-travel-bag-product?
Basically, on a route that shows products ie. /shop. Without an id present on the route path, the app will just fetch a list of products.
However, what if I wanted the products fetched to be from a certain category, /shop/:category
ie /shop/mens or /shop/backpacks.
I could use the category name to query my inventory management platform, but with my specific platform used, It seems it would be better to retrieve items from a specific category id than name, such as /shop/
Updated Question
The same thing with products that I have run into.
I share urls on facebook to that lead to this route
/shop/product/[productId]/page
Easily find product data in db through id and just show data on page.
Though venturing into seo, it seems using descriptive urls is the way to go.
So how would this work in nextjs?
Using the same route I would grab the id and find product but would I jus redirect to new page just to show the same data but a different url resulting in /shop/product/all-new-travel-bag-product?
6 Replies
Asian black bear
Filtering is typically done via search params
Asian black bear
/shop?category=backpacks
Answer
Asian black bear
But I don't understand what your actual question is.
Australian Freshwater CrocodileOP
yes let me clarify, I actually had another question but my draft frm months ago got posted. Thankfully they are both similar and I will edit post with updated question to clarify. One sec...
Australian Freshwater CrocodileOP
@Asian black bear I have updated question.
Are you talking about SEO metadata and like open graph stuff for sharing your Facebook?