New-Rendering

Creates new rendering definition that can later be added to an item.

Syntax

New-Rendering [-Item] <Item> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>]

New-Rendering [-Path] <String> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>]

New-Rendering -Id <String> [-Database <String>] [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>]

Detailed Description

Creates new rendering definition that can later be added to an item. Most parameters can later be overriden when calling Add-Rendering.

© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

Parameters

-Parameter <Hashtable>

Rendering parameters as hashtable

-PlaceHolder <String>

Placeholder for the rendering to be placed into.

-DataSource <Item>

Datasource for the rendering.

-Cacheable <SwitchParameter>

Defined whether the rendering is cacheable.

-VaryByData <SwitchParameter>

Defines whether a data-specific cache version of the rendering should be kept.

-VaryByDevice <SwitchParameter>

Defines whether a device-specific cache version of the rendering should be kept.

-VaryByLogin <SwitchParameter>

Defines whether a login - specific cache version of the rendering should be kept.

-VaryByParameters <SwitchParameter>

Defines whether paremeter - specific cache version of the rendering should be kept.

-VaryByQueryString <SwitchParameter>

Defines whether query string - specific cache version of the rendering should be kept.

-VaryByUser <SwitchParameter>

Defines whether a user - specific cache version of the rendering should be kept.

-Language <String[]>

-Item <Item>

The item to be processed.

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Sitecore.Data.Items.Item

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Sitecore.Layouts.RenderingDefinition

Notes

Help Author: Adam Najmanowicz, Michael West

Examples

EXAMPLE 1

Find item defining rendering and create rendering definition.

# Find the rendering item and convert to a rendering
$renderingPath = "/sitecore/layout/Renderings/Feature/Experience Accelerator/Page Content/Page Content"
$renderingItem = Get-Item -Database "master" -Path $renderingPath | New-Rendering -Placeholder "main"
# Find the item to receive the new rendering
$item = Get-Item -Path "master:\content\Training\Playground\play1\Home"
# Add the rendering to the item
Add-Rendering -Item $item -PlaceHolder "main" -Instance $renderingItem -Parameter @{ "Reset Caching Options" = "1" } -FinalLayout

Last updated