Skip to content

rhythmagency/rhythm.umbraco8.core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

A library of tools for working with Umbraco. The primary class is PublishedContentExtensionMethods.

Refer to the generated documentation for more details.

Installation

Install with NuGet. Search for "Rhythm.Umbraco8.Core".

Overview

PublishedContentExtensionMethods

  • 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");
        }
    }
}

Maintainers

To create a new release to NuGet, see the NuGet documentation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published