Gets the content path.
If the item is a descendant of /sitecore/content, the path relative to "/sitecore/content" is returned with a slash '/' prepended. If not, the absolute path is returned.
The following example determines if an item is located in the News section.
{{
public bool IsLayoutItem(Item item) {
if (item != null) {
string path = item.Paths.ContentPath;
return path.StartsWith("/Home/News");
}
return false;
}
}}
ItemPath Class | Sitecore.Data Namespace