Copied to clipboard

Flag this post as spam?

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


  • Saif Obeidat 79 posts 293 karma points
    Mar 18, 2020 @ 07:19
    Saif Obeidat
    0

    How to add node ID to a node's URL dynamically

    Hello,

    Anyone knows how to implement something like the Umbraco Forums topics URLs.

    as you can see below, Umbraco Forum adds node ID as a prefix to the URL.

    enter image description here

    I've read before, that this can be done by UmbracoUrlName, where you can customize a URL, but I need it dynamically, without the need to edit a node each time.

  • Marc Goodson 1451 posts 9716 karma points MVP 5x c-trib
    Mar 22, 2020 @ 08:06
    Marc Goodson
    100

    Hi Saif

    You can plugin your own logic to how a Url is generated in Umbraco for a particular type of page, you can do this by creating a custom UrlProvider and ContentFinder, to specify the rules for generating the Url and then mapping that incoming Url to the content.

    But you can also customise the logic that generates a particular 'segment' of a url - by creating a custom UrlSegmentProvider... there is an example in the documentation of adding a 'product id sku' to the segment of the Url - see here:

    https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#example

    That might be relevant to what you are trying to achieve.

    regards

    Marc

  • Saif Obeidat 79 posts 293 karma points
    Mar 22, 2020 @ 08:15
    Saif Obeidat
    0

    We have dealt with this issue by creating an UmbracoURLName property, and we've set an event on nodes creation, so we fill UmbracoURLName with the updated URL each time a node gets created. But I think your solutions makes more sense and reliable, we will check it and apply it. Thanks Marc!

  • Saif Obeidat 79 posts 293 karma points
    Mar 23, 2020 @ 13:03
    Saif Obeidat
    0

    This great documentation https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#example helped us in generating a particular segment, Thanks Marc.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies