I am new to developing for Sitecore using MVC. I have a page layout that looks like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@Html.Sitecore().Placeholder("head-meta-content")
</head>
<body>
<div class="willow-page">
@Html.Sitecore().Placeholder("body-content")
</div>
</body>
</html>
And I have the following renderings.
Global alert:
@using Sitecore.Mvc;
@model Sitecore.Mvc.Presentation.RenderingModel
<section class="global-alert" role="alert">
<button class="global-
alert__close">@Html.Sitecore().Field("button-text", Model.Item)
</button>
<h1 class="global-
alert__heading">@Html.Sitecore().Field("heading-text", Model.Item)</h1>
<div class="global-alert__content">
@Html.Sitecore().Placeholder("global-alert-content")
</div>
</section>
Styling Context:
@using Sitecore.Mvc;
@model Sitecore.Mvc.Presentation.RenderingModel
<div class="styling-context">
@Html.Sitecore().Field("Content", Model.Item)
<!-- The Content field is should be a Rich Text Field -->
</div>
What I am trying to accomplish/understand is this. When creating a page using the layout and the 2 renderings, I'd like to add the Global Alert to the body-content
place holder on the layout and then add a Styling Context to the global-alert-content
place holder. Also I'd like to add another Styling Context to the body-content
place holder as well. Like this:
Then when viewing the page content tab in Sitecore, I'd like to see a section with a rich text field for the Global Alert Styling Context & the Body Styling context. I can't seem to figure out how to setup my data to accomplish this.
I've tried to setup the following data templates.
Global Alert Template - Builder
Global Alert Template - Content
Notice the _stylingContext in the Base Template area above.
Styling Context - Builder
Blank Page - Page Template
Note the inherited templates above.
The global alert template is pulling in a styling context template, & the page template is pulling a separate styling context template, I would think there'd be 2 on the page. There isn't though.