Copied to clipboard

Flag this post as spam?

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


  • Alex Skrypnyk 6148 posts 24097 karma points MVP 8x admin c-trib
    Feb 24, 2017 @ 16:34
    Alex Skrypnyk
    0

    NiceUrl for custom pages

    Hello

    We are working on the web application with custom data pages.

    It will be perfect for us to use the same method as Umbraco use in the library.NiceUrl(), but we do not have nodes.

    So we have rows in database like

    Interesting Header 1 Interesting Header 2 Interesting Header 3

    Is there a public method that will take string and return nice url like Umbraco does - "interesting-header-1"

    Thanks,

    Alex

  • Kevin Jump 2327 posts 14813 karma points MVP 8x c-trib
    Feb 25, 2017 @ 19:32
    Kevin Jump
    100

    HI

    you can probibly achive this with the string extensions in Umbraco.Core

    yourstring.ToUrlSegment(); 
    

    will take your string and make it safe to be used as part of an url.

    there are loads of cool extension in that class - I like ReplaceMany and I've just looking now I've just found ToDelimitedList which maybecome my new favourite.

  • Alex Skrypnyk 6148 posts 24097 karma points MVP 8x admin c-trib
    Feb 25, 2017 @ 23:17
    Alex Skrypnyk
    0

    hi Kevin

    Thank you very much, this is exactly what I looked for. Have a nice weekend!

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft