is there a quick and nice or at least any way to get Block's Parent Page?
Let's say I have some Page which has some Block in some of it's ContentArea. How could I get that Page from outside Block's Model/Controller?
Ideally I would like to have a Property - ParentPage - on some Blocks, so I could the access some properties of that ParentPage when used in Block's view... does it makes sense?
CMS version is 11 something...
Any help from these?
Not tested but something like this
if (pageRouteHelper.Page is BasePageData currentPage)
var property = currentPage.Property
So do you want to use the properties of the current page(not sure about parent page) on the block?
You can try this extension method to retrieve the Ancestor and Self-content.
public static IEnumerable<IContent> GetAncestorsAndSelf(this IContentLoader contentLoader, IContent content, bool includeEntries = false)
if (contentLoader == null || content == null)
var ancestorsAndSelf = contentLoader.GetAncestors(content.ContentLink)?.Reverse().ToList() ?? new List<IContent>();
if (includeEntries && content is IContent entry)
var ancestorEntriesAndSelf = contentLoader.GetAncestorEntriesAndSelf(entry);