Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
Have you tried setting the TemplateTypeCategory = EPiServer.Framework.Web.TemplateTypeCategories.MvcPartial instead ?
Otherwise you might want to look at the TemplateCoordinator from the Alloy sample site.
This allows you to wire up a view to a type with a tag if you have no need for a viewmodel.
e.g. in its Register method.
viewTemplateModelRegistrator.Add(typeof(ContentPage), new TemplateModel { Name = "ContentPageWhenTag", Tags = new[] { "List" }, AvailableWithoutTag = false, Path = "~/Views/Partials/ContentPage/List.cshtml") });
It looks like you are passing a viewmodel to your view... but if you can get away with passing the page itself to the view... I would chose the template coordinator method and then you don't need to create additional controllers
regards,
Danny
I have the following code for my regular ContentPage controller
and this for rendering in ContentArea
This is working fine if rendered like @Html.PropertyFor(m => m.MyContentArea, new { Tag = "List" }) in a page view. But, when I have the exact same code in a view for a block. The action on the PartialContentPageController don't get hit. If I set AvailableWithoutTag = true, it hits the action, but I loose the control to choose which view to use for rendering.
Functionality for tags seems to break if a page is rendered inside a ContentArea which is also rendered inside a ContentArea.
Any ideas?