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

Syntax

1
New-Rendering [-Item] <Item> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>]
2
​
3
New-Rendering [-Path] <String> [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>]
4
​
5
New-Rendering -Id <String> [-Database <String>] [-Parameter <Hashtable>] [-PlaceHolder <String>] [-DataSource <Item>] [-Cacheable] [-VaryByData] [-VaryByDevice] [-VaryByLogin] [-VaryByParameters] [-VaryByQueryString] [-VaryByUser] [-Language <String[]>]
Copied!

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
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-PlaceHolder <String>

Placeholder for the rendering to be placed into.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-DataSource <Item>

Datasource for the rendering.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-Cacheable <SwitchParameter>

Defined whether the rendering is cacheable.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-VaryByData <SwitchParameter>

Defines whether a data-specific cache version of the rendering should be kept.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-VaryByDevice <SwitchParameter>

Defines whether a device-specific cache version of the rendering should be kept.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-VaryByLogin <SwitchParameter>

Defines whether a login - specific cache version of the rendering should be kept.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-VaryByParameters <SwitchParameter>

Defines whether paremeter - specific cache version of the rendering should be kept.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-VaryByQueryString <SwitchParameter>

Defines whether query string - specific cache version of the rendering should be kept.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-VaryByUser <SwitchParameter>

Defines whether a user - specific cache version of the rendering should be kept.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-Language <String[]>

Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-Item <Item>

The item to be processed.
Aliases
Text
Required?
true
Position?
1
Default Value
​
Accept Pipeline Input?
true (ByValue, ByPropertyName)
Accept Wildcard Characters?
false

-Path <String>

Path to the item to be processed - can work with Language parameter to narrow the publication scope.
Aliases
Text
Required?
true
Position?
1
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-Id <String>

Id of the item to be processed - can work with Language parameter to narrow the publication scope.
Aliases
Text
Required?
true
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

-Database <String>

Database containing the item to be processed - can work with Language parameter to narrow the publication scope.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false

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.
1
# Find the rendering item and convert to a rendering
2
$renderingPath = "/sitecore/layout/Renderings/Feature/Experience Accelerator/Page Content/Page Content"
3
$renderingItem = Get-Item -Database "master" -Path $renderingPath | New-Rendering -Placeholder "main"
4
# Find the item to receive the new rendering
5
$item = Get-Item -Path "master:\content\Training\Playground\play1\Home"
6
# Add the rendering to the item
7
Add-Rendering -Item $item -PlaceHolder "main" -Instance $renderingItem -Parameter @{ "Reset Caching Options" = "1" } -FinalLayout
Copied!

Related Topics