In EPiServer CMS 7, a content area can be marked with one or more tags:
@Html.PropertyFor(x => x.CurrentPage.MainContent, new { Tag = "ContentTag" })
How can I link page types and tags to create a controller with an attribute TemplateDescriptor:
[TemplateDescriptor(
TemplateTypeCategory = TemplateTypeCategories.MvcPartialController,
Default = true,
Tags = new[] { "ContentTag", "SecondTag" }
)]
public class SitePageDataController : PageController<SitePageData>
{
public ActionResult Index(SitePageData currentContent)
{
return View(currentContent);
}
}
In the above example, SitePageDataController could be selected due to two tags. Is there any way to find out at runtime the tag that resulted in the current controller being selected?
Is their API I can call in my controller an action that will get me a tag?
source
share