This content is archived. See latest version here

Last updated: Mar 31 2014

In EPiServer CMS you can rename files and templates without affecting the links; you can even move an EPiServer CMS site from a virtual directory to a root site without breaking a single link. The reason is a clever way of saving semi-static content in the database.

How it works

Content

Links in EPiServer CMS are not stored in the HTML, instead references called Permanent Links are stored that later on will be resolved to a link. When accessed through a property these references are resolved to the actual link so when you view the content you will find the same HTML you are used to in EPiServer. And again, when you save the content the property will parse the HTML and store Permanent Links instead. The permanent URLs actually work as normal links if you paste them into a browser for debugging purposes.

Additional url segments and query parameters after the content specifying part of the url is preserved during permanent link conversion. This means that you for example can link to a specific action on a controller (potentially with parameters) or something routed by a partial router. There must though be a route registered that match the url.

Built-in properties

Many of the built-in types like Url (corresponds to properties PropertyUrl, PropertyImageUrl etc), XHtmlString (corresponds to PropertyXhtmlString) and LinkItemCollection (corresponds to PropertyLinkItemCollection) all support permanent links. Be aware though that the basic string (corresponds to ProperyString/PropertyLongString) doesn't support permanent links because it may contain other formats than HTML. Be sure to use the XhtmlString for all HTML content to make use of permanent links.

Link integrity tracking

During save of a content instance the properties that can contain links (for example PropertyUrl, PropertyXhtmlString, PropertyLinkItemCollection and PropertyContentArea) are parsed for links to other content instances or files. The references are stored in a reference table to be able to track the usage which items that links to each other.

Web services and RawContent/RawPage/RawProperty

The raw data transfer types used when transferring content (primarily by Web Services and mirroring/export/import) only exposes the permanent links, if you need to use any other links you have to handle the conversion between the Page object to the RawPage object yourself or add post-processing.

References

API

The interface EPiServer.Core.Transfer.IReferenceMap on your PropertyData object tells EPiServer that you need to handle Permanent Links. The Permanent Link Mapper handles all conversion between permanent links and dynamic links. This API can be accessed using the EPiServer.Web.PermanentLinkUtility class. The EPiServer.Web.IPermanentLinkMapper and EPiServer.Web.PermanentLinkMap classes are underlying components in the PermanentLink architecture and under normal circumstances you do not need to access them directly.

Content links

Permanent links to content consists of the GUID associated with a content, also available as the property IContent.ContentGuid.

Definition: ~/link/ContentGUID.extension?EXTRAINFO.

See also


Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/