Posted in: Comments

Alright, so it turns out EPiServer 7 (and later versions) already has a route for permanent links. It was slightly different from the one I created, so here’s an updated version of the extension method:

public static string PermanentLink(this PageData page)
{
    var url = new UriBuilder(Settings.Instance.SiteUrl);

    var languageBranch = ServiceLocator.Current.GetInstance<ILanguageBranchRepository>()
        .Load(page.Language);

    url.Path = string.Format("/{0}/link/{1}",
        languageBranch.CurrentUrlSegment,
        page.ContentGuid.ToString("N"));

    return url.Uri.AbsoluteUri;
}

So no need to register your own route.