Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Krishna 7 posts 27 karma points
    Feb 28, 2018 @ 13:42
    Krishna
    0

    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.

  • Steve Morgan 1349 posts 4458 karma points c-trib
    Feb 28, 2018 @ 13:56
    Steve Morgan
    1

    Hi Mike,

    I think you're looking for custom routes.

    https://our.umbraco.org/documentation/reference/routing/custom-routes

    Kind regards

    Steve

  • Krishna 7 posts 27 karma points
    Mar 03, 2018 @ 09:31
    Krishna
    0

    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

  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Mar 03, 2018 @ 10:10
    Kevin Jump
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft