Promotional banners are configured in Umbraco using a document type in the Escc.EastSussexGovUK.Umbraco.Web
project, but can be displayed on any page using the website template. They normally appear on the right-hand side in the desktop layout, but not on mobile. Banners are not part of the template by default, so any page that wants to support banners needs to opt-in with the following steps:
- Load
~\Escc.EastSussexGovUK.TemplateSource\js\min\banners.js
. This is dependent on other scripts (JQuery, JQuery Retry andcascading-content.js
) but these are loaded by default. The recommended way to loadbanners.js
varies depending on whether your project is using ASP.NET Core MVC, ASP.NET MVC5 or ASP.NET WebForms. - Have a
<span class="escc-banners"></span>
element where the banners should be added on the page. The ASP.NET Core MVC~\Views\_EastSussexGovUK_Banners.cshtml
can be used to add this in a consistent, future-proofed way. In ASP.NET MVC5~\Views\EastSussexGovUK\Features\_Banners.cshtml
can be used. - Ensure
config.js
includes anesccConfig.BannersUrl
property which points to JSON data published by theEscc.EastSussexGovUK.Umbraco.Web
project. - Have a content security policy with a
connect-src
which allows the domain specified inesccConfig.BannersUrl
, and aimg-src
that allows the banner images to display. - Have your application's domain listed in
web.config
for the site hostingEscc.EastSussexGovUK.Umbraco.Web
as an allowed domain for CORS requests.