I created a new layout and page template and would like it to work with SXA in Experience Editor. I needed to add the following to get it to render any components with rendering variants:
<experienceAccelerator>
<renderingVariants>
<allowedTemplates>
<template name="Modal">{881F54C1-D532-458D-9376-A7AD21851AAB}</template>
</allowedTemplates>
</renderingVariants>
<localDatasources>
<pageRelativeLocationAllowedTemplates>
<template name="Modal">{881F54C1-D532-458D-9376-A7AD21851AAB}</template>
</pageRelativeLocationAllowedTemplates>
</localDatasources>
</experienceAccelerator>
However two last issues, one is when adding a Container
component I get this error:
Exception: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: url
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
at Sitecore.Text.UrlString..ctor(String url)
at Sitecore.XA.Foundation.Grid.Pipelines.ExecutePageEditorAction.FillGridDefaultValues.GetTargetParameters(IInsertRenderingArgs args)
at Sitecore.XA.Foundation.Grid.Pipelines.ExecutePageEditorAction.FillGridDefaultValues.Process(PipelineArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Pipelines.ExecutePageEditorAction.ExecutePageEditorActionPipeline.Run(ExecutePageEditorActionArgs args)
at Sitecore.Shell.Applications.WebEdit.Palette.OnPreInit(EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The other issue is that the SXA toolbox doesn't show.
Edit:
I'm on SXA 10.0
Thanks to pete I have added this config too
<mvc>
<hiddenPlaceholders>
<layout id="{D6234A91-C8BD-45FC-8184-6B573AE1D651}">
<placeholder name="head"/>
<placeholder name="body-bottom"/>
<placeholder name="body-top"/>
</layout>
</hiddenPlaceholders>
</mvc>
Here's my layout:
@model Sitecore.Mvc.Presentation.RenderingModel
@{
AssetLinks assetLinks = null;
}
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="@Model.Item.Language.Name">
<!--<![endif]-->
<head>
@if (Html.Sxa().IsEdit)
{
assetLinks = AssetLinksGenerator.GenerateLinks(new ThemesProvider());
foreach (string style in assetLinks.Styles)
{
@Html.Raw(style)
}
}
@Html.Sxa().VisitorIdentification()
<meta name="robots" content="noindex">
@Html.Sxa().Placeholder("head")
</head>
<body @Html.Sxa().Body().Decorate()>
@Html.Sitecore().Placeholder("body-top")
@Html.Sxa().GridBody()
@Html.Sitecore().Placeholder("body-bottom")
@if (Html.Sxa().IsEdit)
{
foreach (string script in assetLinks.Scripts)
{
@Html.Raw(script)
}
}
</body>
</html>
Thanks to Miguel Minoldo to get the toolbox working, but still getting the same error, only on the "main" placeholder, and only on the container. I am not adding a new Device, and the grid mapping in the Settings item is correct.
My main goal here is to have a layout that doesn't render any scripts or styles when not in edit mode.