This is probably a stupid question but I’m confused why calling GetBlockListHtml() seems to differ depending on whether you have a template or not.
Without a template i.e. calling @Html.GetBlockListHtml(Model.MyBlocks) the partial for the individual “MyBlock” inherits from BlockListItem as explained in the documentation.
However when calling with a template @Html.GetBlockListHtml(Model.MyBlocks, “MyTemplate”) it seems to inherit from BlockListModel instead.
When you are calling @Html.GetBlockListHtml without passing in a template name, it is, behind the scenes, calling the “default” partial which Umbraco ships with. This partial expects a BlockListModel which is the type the block list data is initially converted to via the core Property Value Convertor.
The BlockListModel is actually an IEnumerable of BlockListItems, and in the default partial code it loops through this and then calls the individual partials for each of the blocks within the block list.
When you are explicitly naming the template, you are calling your own “theme” template, for once of a better phrase - which is essentially your own version of the “default” partial. This is why it needs to have a model of type BlockListModel, as you are then responsible for looping around the model and calling the individual blocks.
Yes thanks that helps me understand it. I was having a major brain malfunction and just couldn’t figure it out even though I’m pretty sure I already knew that’s how it worked.