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.
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
Do you mean umbraco.library.NiceUrl(int nodeId)?
That takes the page ID and returns a URL
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
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:
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.
tht's wht i need. thx for ur help.
is working on a reply...