Try our conversational search powered by Generative AI!

list of block with certain category

Vote:
 

Similar to the page list in the alloy, i want to have a list of blocks with a certain category?

#178991
May 29, 2017 12:33
Vote:
 

If you are retrieving list of blocks from page's content area, then one way to filter stuff out would be to cast to `ICategorizable`:

var items = currentPage.MainContentArea.FilteredItems
    .Select(cai => _loader.Get<BlockData>(cai.ContentLink))
    .Where(i => ((ICategorizable)i).Category.Contains(...));
#179034
May 30, 2017 9:00
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.