Model Page Includes as Page Regions (.NET)
To simplify the page model structure and improve the clarity of the View code, starting from version 1.1, SDL Digital Experience Accelerator will treat Page Includes as Page Regions.
If you are still using Page Includes, DXA will display a warning message during the compilation of the View code.
Example
Here is the example of the source code of the General Page View with new page model structure:
@model PageModel
@{
bool hasLeftBar = Model.Regions.ContainsKey("Left Navigation") || Model.Regions.ContainsKey("Left");
int mainContainerSize = hasLeftBar ? 9 : 12;
}
@Html.DxaRegion("Header")
<main class="page-row page-row-expanded" role="main">
<div class="container-fluid page-border">
@Html.DxaRegion("Hero")
@Html.DxaRegion("Content Tools")
<div class="row">
@if (hasLeftBar)
{
<div class="col-sm-12 col-md-3">
@Html.DxaRegion("Left Navigation", containerSize: 3)
@Html.DxaRegion("Left", containerSize: 3)
</div>
}
<div class="col-sm-12 col-md-@(mainContainerSize)">
@Html.DxaRegions(exclude: "Header,Footer,Hero,Content Tools,Left Navigation,Left", containerSize: mainContainerSize)
</div>
</div>
</div>
</main>
@Html.DxaRegion("Footer")