There is nothing in the Sitecore API that will provide what you need, but you can create a helper method to achieve what you need. I assume you are using LinkField .
Brian Pedersen's blog post has an article on Sitecore Links with LinkManager and MediaManager . The following is a snippet of code taken from his article:
Sitecore.Data.Fields.LinkField lf = Sitecore.Context.Item.Fields["Link"]; switch (lf.LinkType.ToLower()) { case "internal": // Use LinkMananger for internal links, if link is not empty return lf.TargetItem != null ? Sitecore.Links.LinkManager.GetItemUrl(lf.TargetItem) : string.Empty; case "media": // Use MediaManager for media links, if link is not empty return lf.TargetItem != null ? Sitecore.Resources.Media.MediaManager.GetMediaUrl(lf.TargetItem) : string.Empty; case "external": // Just return external links return lf.Url; case "anchor": // Prefix anchor link with
If you need to allow the internal URL to be fully consistent with the domain name, go to UrlOptions.SiteResolving=True to LinkManager .
source share