Copied to clipboard

Flag this post as spam?

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


  • Carlos Mosqueda 240 posts 431 karma points
    Jan 02, 2019 @ 22:19
    Carlos Mosqueda
    0

    How to get the current page URL without the full path

    Hello, I am trying to get the current page URL from Umbraco but I don't want the full folder path, just the current one.

    So in my case the URL would be something like this:

    https://mysite.com/somepage/some-other-page/my-page-i-want-url-for

    In this case you can see I actually only want the part "my-page-i-want-url-for". I tried @Model.Url, but that gives me the fully qualified URL.

    Thanks in advance.

  • Amir Khan 1282 posts 2739 karma points
    Jan 03, 2019 @ 00:55
    Amir Khan
    0

    Could you do something like this or are you worried about there being other special characters in there? Its not fool proof but it will get the job done if you can control the page names somewhat: @Model.Name.Replace(" ", "-")

    -Amir

Please Sign in or register to post replies

Write your reply to:

Draft