A library of tools for working with Umbraco. The primary class is PublishedContentExtensionMethods
.
Refer to the generated documentation for more details.
Install with NuGet. Search for "Rhythm.Umbraco8.Core".
- NearestAncestorOfTypes Searches for the nearest ancestors with the specified content types.
- ChildrenByTypePath Finds the descendant children located by the specified list of content type aliases, relative to the specified page.
- DescendantsOfTypes Finds the descendants by the supplied content type aliases.
The following code sample shows how to use both NearestAncestorOfTypes
and ChildrenByTypePath
to get the blog articles in the current site:
namespace Sample
{
using Rhythm.Umbraco.Core;
using System.Collections.Generic;
using Umbraco.Core.Models.PublishedContent;
public class ArticleHelper
{
public IEnumerable<IPublishedContent> GetArticles(IPublishedContent page)
{
return page
.NearestAncestorOfTypes(true, "home", "homepage")
.ChildrenByTypePath("blogLanding", "blogArticle");
}
}
}
To create a new release to NuGet, see the NuGet documentation.