/// <summary> /// Returns the strongly typed content item based on the item's URL. /// Uses the home node to traverse descendants to find matching URL. /// </summary> /// <returns>Published content based on provided URL</returns> public static IPublishedContent GetTypedContentByUrl(this UmbracoHelper helper, string url) { var root = helper.GetHomeContent(); return(root.DescendantsOrSelf().FirstOrDefault(x => x.Url.Equals(url, StringComparison.OrdinalIgnoreCase))); }
/// <summary> /// Gets content based on the name in the CMS. /// </summary> /// <param name="helper"></param> /// <param name="name">Name of content to find</param> /// <returns></returns> public static IEnumerable <IPublishedContent> GetContentByName(this UmbracoHelper helper, string name) { return(helper.GetHomeContent().DescendantsOrSelf().Where(x => x.Name.Equals(name))); }