Display templates
A display template defines the rendering of fields in the MVC accelerator.
Note: The display template for products and categories was removed in version 8.12 and some of it's features were moved into the field templates.
URLs for variants
The display template for the Products area (PIM) decides if variants should be exposed as separate items with their own URL on the public site, or if they all should be exposed as a product family with one URL.
Rendering pages and blocks
For each page type in the Websites area (CMS), you define a controller and a view for it. Blocks are also defining the controller that should be used for rendering, in a similar way to pages.
By selecting the controller name and action in the display template field of the field template, you connect the controller, view, and field template together. The setting looks like this:
In ArticleController, you define the logic to build the article page model and return that data to ArticleView, which contains the layout for that page type:
using Litium.Web.Models.Websites;
using System.Web.Mvc;
using Litium.Accelerator.Builders.Article;
namespace Litium.Accelerator.Mvc.Controllers.Article
{
public class ArticleController : ControllerBase
{
private readonly ArticleViewModelBuilder _articleViewModelBuilder;
public ArticleController(ArticleViewModelBuilder articleViewModelBuilder)
{
_articleViewModelBuilder = articleViewModelBuilder;
}
[HttpGet]
public ActionResult Index(PageModel currentPageModel)
{
var model = _articleViewModelBuilder.Build(currentPageModel);
return View(model);
}
}
}