In this tutorial, you will learn how to get the editor URL for an Episerver page. Once a content editor follows the link, a page will open the page within edit mode. Creating editor links for pages can improve the content editors' experience. For example, creating a custom link within the quick navigator. To get the edit URL you can use the static PageEdititng
helper. You can get the editor URL by passing in the content reference to the page you want to link to, like this:
This will give you a URL that looks like this:
In this example, the number 3
maps to the content ID
for a page. I recommend that you always use this helper when working with newer versions of Episerver. There is an alternative way to render an edit link using the UrlResolver
helper. For completeness let us also look at this technique:
This API will return an internal link, in this format:
If you try to navigate to the internal link via a browser, it is likely you will get a 404 page rather than being redirected to the editor. So it is best to use the external URL. If you are using version 7 of Episerver, then an even older way of getting the edit URL was using the routeing table, like this:
This API is still available within the latest versions of Episerver, however, it is tagged with the obsolete
attribute and I recommend you avoid using it. If you try and use it do not be surprised if you see a warning. If you are working with legacy code though it might come in handy to understand. Happy Coding!