TigerMan
07/02/2024, 9:08 AMLamont
07/02/2024, 6:40 PM@foreach (var block in Model) {
@await Html.PartialAsync($"~/Views/Partials/blocks/{block.Content.ContentType.Alias}.cshtml", block)
}
And then in the view(s):
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>
@{
if (Model.Content is not ElementTypeHere content)
{
// error message/handling/etc
return;
}
// else, content now a typed variable for your element
}
And you just access everything as a property with strongly typed models. Or, if you don't want strongly typed, Elements can just be generically IPublishedContent.