Find rendering 2
# Define the path to the items you want to inspect
$path = "master:/sitecore/content/Home"
# Get all items under the specified path
$items = Get-ChildItem -Path $path -Recurse
# Loop through each item
foreach ($item in $items) {
# Check if the item has layout details
if ($item."__Renderings" -ne "" -or $item."__Final Renderings" -ne "") {
Write-Host "Item Name: $($item.Name), Item Path: $($item.ItemPath)"
# Access both shared and final layout details
$layouts = @("__Renderings", "__Final Renderings")
foreach ($layout in $layouts) {
# Check if the layout field is not empty
if ($item.Fields[$layout] -ne $null -and $item.Fields[$layout] -ne "") {
$renderingXml = [Sitecore.Layouts.LayoutDefinition]::Parse($item[$layout])
foreach ($device in $renderingXml.Devices) {
foreach ($rendering in $device.Renderings) {
Write-Host " Rendering: $($rendering.ItemID), Placeholder: $($rendering.Placeholder), Device: $($device.ID)"
}
}
}
}
}
}