Steps to add the Layout Container Component to your XMCloud project
-
Clone the repository
Begin by cloning the following repository: https://github.com/sitecorelabs/sitecore-xmcloud-components-layout-container
-
Copy serialized Items files
Copy
layoutcontainer.module.json
file fromsrc
to your repository’ssrc
folderEnsure
layoutcontainer.module.json
path matches modules wildcard insitecore.json
in the root of project repositoryCopy
LayoutContainer
folder fromsrc\items
folder toItems
folder in your repositoryFor XM Cloud Starter Kit, items are typically located in
src/items
-
Copy Component and styles
3.1 Copy component
Copy
LayoutContainer.tsx
file fromsrc\components
folder to yourcomponents
folderFor XM Cloud Starter Kit, components are typically located in:
src\sxastarter\src\components
3.2 Copy styles
Copy
src\components\assets\sass\layout-container
folder to your repository styles folderFor XM Cloud Starter Kit, styles are typically located in:
src\sxastarter\src\assets\sass\components\
3.3 Import styles
For example, in XM Cloud Starter Kit
• Locate the
src\sxastarter\src\assets\sass\components\index.scss
file• Import styles by adding this statement:
@import "layout-container";
-
Apply Items Serialization
For example, in XM Cloud Starter Kit
• Open the
up.ps1
file present at the repository root• Find the existing serialization command (
dotnet sitecore ser push -i RenderingHost
)• Add new commands after it
Write-Host "Pushing LayoutContainer component serialization" -ForegroundColor Green dotnet sitecore ser push -i LayoutContainer
• Run
up.ps1
-
Enable
Layout container
component for site• Open
Content Editor
in your XM Cloud instance e.g. https://xmcloudcm.localhost/sitecore and navigate to your site in the content tree• Under the
Presentation
section, expandAvailable Renderings
• Click on
Page Structure
and clickEdit
in theData
section• In the
Page Structure
rendering, locate theLayout Container
component• Add the
Layout Container
to thePage Structure
rendering.Path: Layout\Renderings\Feature\Headless Experience Accelerator\Layout Container
-
Verify in XM Cloud Pages
• Navigate to your site in XM Cloud Pages
• The
Layout Container
component should now appear in thePage Structure
section