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 76 posts 286 karma points
    17 days ago
    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 1118 posts 7507 karma points MVP 4x c-trib
    1 week ago
    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 76 posts 286 karma points
    1 week ago
    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 76 posts 286 karma points
    1 week ago
    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.

Please Sign in or register to post replies

Write your reply to:

Draft