LinkManager
Syntax#
- public static string GetItemUrl(Item item)
- public static string GetItemUrl(Item item, UrlOptions options);
Obtaining a url for an Item
Given a simple sitecore item:
Item item;
The item itself does not contain itβs url. To obtain a url for an item you need to make a call to the static
class Sitecore.Links.LinkManager
string url = LinkManager.GetItemUrl(item);
an overload of this accepts a UrlOptions
class:
UrlOptions options = new UrlOptions
{
AddAspxExtension = false
....
};
string url = LinkManager.GetItemUrl(item, options);