Copied to clipboard

Flag this post as spam?

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


  • Kurniawan Kurniawan 202 posts 225 karma points
    Nov 03, 2010 @ 04:05
    Kurniawan Kurniawan
    0

    Code to generate Link To Document (Friendly URL)

    Hi All,

    I try to find from umbraco code where generate the friendly url.
    as you seen in linkToDocument after you publish a content.

    For example about&whatever become aboutandwhatever ?

    I just want to reuse that code to generate my friendly url on my friendly table.

    Any reference ?

     

    Thanks

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Nov 03, 2010 @ 04:55
    Aaron Powell
    0

    Do you mean umbraco.library.NiceUrl(int nodeId)?

    That takes the page ID and returns a URL

  • Kurniawan Kurniawan 202 posts 225 karma points
    Nov 03, 2010 @ 06:49
    Kurniawan Kurniawan
    0

    I am looking the actual function which generate the url from the name.

    For example, The name = "about & something" - it returns "aboutsomething"

    Which function is doing this ?

    I guess it will be inside NiceUrl() ?

     

    Thanks

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Nov 03, 2010 @ 07:22
    Aaron Powell
    2

    NiceUrl works recursively by looking at the XML cache which has a UrlName property (oddly enough that's not exposed by NodeFactory).

    The UrlName property is generated by this method:

    umbraco.cms.helpers.url.FormatUrl(string url)

    This runs through all the formatting settings defined in umbracoSettings.config.

    Note this will only change the page name, not the whole Uri, so if you're wanting /some-page/some-other-page you'd need to make a recursive call to that.

  • Kurniawan Kurniawan 202 posts 225 karma points
    Nov 04, 2010 @ 13:23
    Kurniawan Kurniawan
    0

    tht's wht i need. thx for ur help.

Please Sign in or register to post replies

Write your reply to:

Draft