I have a web app built in Umbraco which displays product information. Products are listed into category page. Products information is stored in a separate database.
Category URL is like : /category (this is a Umbraco page)
Product page should look like: /category/product-name
More specific information of product can be accessed by: /category/product-name/{product-spec}
So, the /category is a node page inside Umbraco and the appended URL is a dynamic URL.
How do I extend the URL of product page without using controller/action (MVC) ?
Any help is highly appreciated. Thanks in advance.
I think you might need to look at creating a ContentFinder and URLProvider to mange the routes.
Umbraco uses ContentFinders to get from an URL to a page, and you can write your own and add them to the list of resolvers. typically you add a content resolver just before the 404 (not found resolver) so Umbraco trys to find content at the URL and if it can't your resolver is called.
In your content finder you can search for the products based on the url/product id, and then set the published node and template - these are then given back to umbraco that renders the page.
A URLProvider is the other half of the puzzle as it lets you change/add the URL to your product node, which is useful because then things like Model.Content.Url can be made to map to the right location even if the product is in another place on the site.
Custom URL in Umbraco
I have a web app built in Umbraco which displays product information. Products are listed into category page. Products information is stored in a separate database.
Category URL is like : /category (this is a Umbraco page) Product page should look like: /category/product-name More specific information of product can be accessed by: /category/product-name/{product-spec}
So, the /category is a node page inside Umbraco and the appended URL is a dynamic URL.
How do I extend the URL of product page without using controller/action (MVC) ?
Any help is highly appreciated. Thanks in advance.
Hi Mike,
I think you're looking for custom routes.
https://our.umbraco.org/documentation/reference/routing/custom-routes
Kind regards
Steve
Hi Steve, I'm not sure if we can use both MVC routes and default Umbraco routes at the same time.
The page is an Umbraco node: /category and product url is appended to category URL like: /category/product-url.
Is there any way in Umbraco where we can intercept the URL in a partial view/macro and get the appended URL /product-info ?
Thanks, Krishna
Hi Krishna,
I think you might need to look at creating a ContentFinder and URLProvider to mange the routes.
Umbraco uses ContentFinders to get from an URL to a page, and you can write your own and add them to the list of resolvers. typically you add a content resolver just before the 404 (not found resolver) so Umbraco trys to find content at the URL and if it can't your resolver is called.
This 24 Days article is a good place to start : https://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/
In your content finder you can search for the products based on the url/product id, and then set the published node and template - these are then given back to umbraco that renders the page.
A URLProvider is the other half of the puzzle as it lets you change/add the URL to your product node, which is useful because then things like Model.Content.Url can be made to map to the right location even if the product is in another place on the site.
is working on a reply...