Umbraco-CMS: v8: Missing extension methods to get siblings
In v8 it seems IPublishedContent is missing extension methods to get sibling node, e.g. sibling of type or siblings of any type.
You can use e.g. node.Parent.Children() or node.Parent.ChildrenOfType() of do some querying on this, but it won’t work if the node is under root level, so it hasn’t any parent node.
In v7 there are many extension methods for these.
.Sibling()
.Siblings()
.Siblings<T>()
.PrecedingSibling()
.PrecedingSibling<T>()
.FollowingSibling()
.FollowingSibling<T>()
.Previous()
.Previous<T>()
.Next()
.Next<T>()
In v8 we should probably have extension method as .Sibling(), .Sibling(), SiblingsOfType() like we have e.g, .ChildrenOfType().
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (19 by maintainers)
I have updated the PR to contain both
SiblingsandSiblingsAndSelf. I added remark to theSiblingsXMLDoc about the difference compared to V7.@bergmania As you mention earlier, the node itself usually gets rendered differently and we already have it anyway (otherwise we cannot call
.Siblings()or.ParentChildren()on it), so I do not see why it should be returned again.Off the top of my head I can imagine a scenario where the node itself gets rendered as the main thing, and then there is a list of siblings() for further navigating, e.g.:
I’m sure there are plenty of other use cases.