Introduction
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.
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 datatransfer types used when transfering 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.
File Links
Permanent links to files are handled similar to pages but with one significant
difference. Because files are stored on disk it's up to each Virtual Path Provider to associate a GUID with a file. The default provider for files in EPiServer
CMS uses a technology where helper files and folders are created and after which it stores this metadata when linking to a file. This means that you should never rename files and folders using Windows Explorer (but you may upload new files).
Definition: ~/link/FILEGUID.extension.
Do you find this information helpful? Please log in to provide feedback.