sitecore LinkManager Obtaining a url for an Item

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

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);


Got any sitecore Question?