Pages without a rendering - Downloadable excel

Add-Type -AssemblyName "Sitecore.Kernel"

$rootPath = "/sitecore/content/Sites/my site/home/offices"
$templateId = "{xxxxxx-CE5E-42EE-902D-xxxxxxx}"
$renderingId = "{xxxxxxx-7433-4FEB-99F5-xxxxxx}"

# Export path (change as needed)
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
$exportPath = "C:\Temp\Offices_Missing_Rendering_$timestamp.csv"

# Get default device (typically 'default')
$device = [Sitecore.Context]::Device
if (-not $device) {
    Write-Host "Device context not available. Falling back to master device ID." -ForegroundColor Yellow
    $device = Get-Item "/sitecore/layout/Devices/Default"
}

Write-Host "Getting root item at: $rootPath"
$rootItem = Get-Item -Path $rootPath

if (-not $rootItem) {
    Write-Host "Root item not found. Exiting." -ForegroundColor Red
    return
}

$descendants = Get-ChildItem -Path $rootItem.Paths.FullPath -Recurse | Where-Object {
    $_.TemplateID.Guid -eq $templateId
}

Write-Host "Found $($descendants.Count) matching office items."

$itemsWithoutRendering = @()
$index = 1

foreach ($item in $descendants) {
    Write-Host "[$index/$($descendants.Count)] Checking item: $($item.Paths.FullPath)"

    $finalRenderingsField = $item.Fields["__Final Renderings"]

    if ($finalRenderingsField -and $finalRenderingsField.HasValue) {
        $layoutXml = [Sitecore.Data.Fields.LayoutField]::GetFieldValue($finalRenderingsField)

        if (![string]::IsNullOrWhiteSpace($layoutXml)) {
            try {
                $layoutDef = [Sitecore.Layouts.LayoutDefinition]::Parse($layoutXml)

                if ($layoutDef -ne $null) {
                    $deviceDef = $layoutDef.GetDevice($device.ID.ToString())

                    $hasRendering = $false

                    if ($deviceDef -and $deviceDef.Renderings) {
                        foreach ($rendering in $deviceDef.Renderings) {
                            if ($rendering.ItemID -eq $renderingId) {
                                $hasRendering = $true
                                break
                            }
                        }
                    }

                    if (-not $hasRendering) {
                        Write-Host "  -> Rendering NOT found in Final Layout." -ForegroundColor Yellow
                        $itemsWithoutRendering += [PSCustomObject]@{
                            Name = $item.Name
                            Path = $item.Paths.FullPath
                            ID   = $item.ID
                        }
                    } else {
                        Write-Host "  -> Rendering found." -ForegroundColor Green
                    }
                } else {
                    Write-Host "  -> LayoutDefinition parsing returned null." -ForegroundColor Yellow
                }
            }
            catch {
                Write-Host "  -> ERROR parsing layout XML: $_" -ForegroundColor Red
            }
        } else {
            Write-Host "  -> Final Renderings field is empty." -ForegroundColor Yellow
            $itemsWithoutRendering += [PSCustomObject]@{
                Name = $item.Name
                Path = $item.Paths.FullPath
                ID   = $item.ID
            }
        }
    } else {
        Write-Host "  -> Final Renderings field not found or empty." -ForegroundColor Yellow
        $itemsWithoutRendering += [PSCustomObject]@{
            Name = $item.Name
            Path = $item.Paths.FullPath
            ID   = $item.ID
        }
    }

    $index++
}

Write-Host "`nTotal items without rendering in Final Layout: $($itemsWithoutRendering.Count)" -ForegroundColor Cyan

# Export to CSV
$itemsWithoutRendering | Export-Csv -Path $exportPath -NoTypeInformation -Encoding UTF8

Write-Host "Export completed: $exportPath" -ForegroundColor Green

Pages without a rendering - Show List View

 Add-Type -AssemblyName "Sitecore.Kernel"


$rootPath = "/sitecore/content/Sites/mysite/home/offices"
$templateId = "{xxxxxx-CE5E-42EE-902D-xxxxxxxxx}"
$renderingId = "{xxxxxxx-7433-4FEB-99F5-xxxxxxxxxx}"

# Get the default device (typically 'default')
$device = [Sitecore.Context]::Device
if (-not $device) {
    Write-Host "Device context not available. Falling back to master device ID." -ForegroundColor Yellow
    $device = Get-Item "/sitecore/layout/Devices/Default"
}

Write-Host "Getting root item at: $rootPath"
$rootItem = Get-Item -Path $rootPath

if (-not $rootItem) {
    Write-Host "Root item not found. Exiting." -ForegroundColor Red
    return
}

$descendants = Get-ChildItem -Path $rootItem.Paths.FullPath -Recurse | Where-Object {
    $_.TemplateID.Guid -eq $templateId
}

Write-Host "Found $($descendants.Count) matching office items."

$itemsWithoutRendering = @()
$index = 1

foreach ($item in $descendants) {
    Write-Host "[$index/$($descendants.Count)] Checking item: $($item.Paths.FullPath)"

    $finalRenderingsField = $item.Fields["__Final Renderings"]

    if ($finalRenderingsField -and $finalRenderingsField.HasValue) {
        $layoutXml = [Sitecore.Data.Fields.LayoutField]::GetFieldValue($finalRenderingsField)

        if (![string]::IsNullOrWhiteSpace($layoutXml)) {
            try {
                $layoutDef = [Sitecore.Layouts.LayoutDefinition]::Parse($layoutXml)

                if ($layoutDef -ne $null) {
                    $deviceDef = $layoutDef.GetDevice($device.ID.ToString())

                    $hasRendering = $false

                    if ($deviceDef -and $deviceDef.Renderings) {
                        foreach ($rendering in $deviceDef.Renderings) {
                            if ($rendering.ItemID -eq $renderingId) {
                                $hasRendering = $true
                                break
                            }
                        }
                    }

                    if (-not $hasRendering) {
                        Write-Host "  -> Rendering NOT found in Final Layout." -ForegroundColor Yellow
                        $itemsWithoutRendering += [PSCustomObject]@{
                            Name = $item.Name
                            Path = $item.Paths.FullPath
                            ID   = $item.ID
                        }
                    } else {
                        Write-Host "  -> Rendering found." -ForegroundColor Green
                    }
                } else {
                    Write-Host "  -> LayoutDefinition parsing returned null." -ForegroundColor Yellow
                }
            }
            catch {
                Write-Host "  -> ERROR parsing layout XML: $_" -ForegroundColor Red
            }
        } else {
            Write-Host "  -> Final Renderings field is empty." -ForegroundColor Yellow
            $itemsWithoutRendering += [PSCustomObject]@{
                Name = $item.Name
                Path = $item.Paths.FullPath
                ID   = $item.ID
            }
        }
    } else {
        Write-Host "  -> Final Renderings field not found or empty." -ForegroundColor Yellow
        $itemsWithoutRendering += [PSCustomObject]@{
            Name = $item.Name
            Path = $item.Paths.FullPath
            ID   = $item.ID
        }
    }

    $index++
}

Write-Host "`nTotal items without rendering in Final Layout: $($itemsWithoutRendering.Count)" -ForegroundColor Cyan

$itemsWithoutRendering | Show-ListView -Title "Offices Missing SchemaOfficePageReview Rendering" -Property Name, Path, ID

Create self signed certificate and add to trusted root locally

 ðŸŸ© Step 1: Create the Certificate (PowerShell)

Open PowerShell as Administrator and run:

New-SelfSignedCertificate ` -DnsName "Domain.dev.local" ` -CertStoreLocation "cert:\LocalMachine\My" ` -FriendlyName "Domain Local Dev Cert" ` -NotAfter (Get-Date).AddYears(5)

This creates a certificate stored under Local Machine > Personal.

🟩 Step 2: Export the Certificate (for trusting)

Press Win + R → type mmc → Enter.
Go to File > Add/Remove Snap-in.
Add Certificates for Local Computer.
Go to Certificates > Personal > Certificates
Find "Domain Local Dev Cert" or Domain.dev.local.
Right-click it → All Tasks > Export (Base 64).
Choose No, do not export the private key.
Save it as a .cer file (e.g., domain.trust.cer).

🟩 Step 3: Trust the Certificate
In MMC, go to:
Certificates > Trusted Root Certification Authorities > Certificates
Right-click → All Tasks > Import.
Import the .cer file you just exported.

Now your system will trust https://Domain.dev.local/.

🟩 Step 4: Bind Certificate in IIS

Open IIS Manager.

Go to Sites > Domain.dev.local (or your site name).

On the right → click Bindings.

Add or Edit an HTTPS binding:

select the one you created (by Friendly Name or domain).

Troubleshoot personalization on xm cloud

Here are the troubleshooting steps below that helped personalization to work. We checked the events analytics in the page builder but it was...