Copied to clipboard

Flag this post as spam?

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

  • Chris Mahoney 220 posts 429 karma points
    May 08, 2015 @ 04:28
    Chris Mahoney

    Preferred way to link to a page from template?


    I'm trying out Umbraco 7.2.4 and would like to know the best way to link to another page on my site from a template. In 4 and 6 I could do something like <a href="/{local Link:1234}"> (no space) and it'd link to the page with that ID, maintaining the link automatically as the page is moved or renamed. However, in 7, that doesn't work; it just copies the HTML verbatim instead of linking to the right page.

    I haven't been able to find any documentation around how to accomplish this in 7. Naturally I don't want to use the actual URL in case the target page is moved. What's the best way to do this?

    Thanks :)

  • Dennis Aaen 4498 posts 18207 karma points admin hq c-trib
    May 08, 2015 @ 10:00
    Dennis Aaen

    Hi Chris,

    The way you can do it is to use one of the Umbraco helpsers

    To do it in the dynamic Razor you could use:


    For the strongly typed Razor you can use.


    Hope this helps,


  • Jeavon Leopold 3062 posts 13533 karma points MVP 9x admin c-trib
    May 08, 2015 @ 10:21
    Jeavon Leopold

    If you only want the URL you could use the NiceUrl method



  • Chris Mahoney 220 posts 429 karma points
    May 10, 2015 @ 22:07
    Chris Mahoney

    Yes, NiceUrl works. Thanks for that. Going from 6 to 7 is proving "interesting"! :)

Please Sign in or register to post replies

Write your reply to: