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
I would like to share the things that can provide information or help someone to achieve something. I research, I practice then I share. Please leave your comment if I can do better for you.
Pages without a rendering - Downloadable excel
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)PressWin + R
→ typemmc
→ Enter.Go to File > Add/Remove Snap-in.Add Certificates for Local Computer.Go to Certificates > Personal > CertificatesFind "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 CertificateIn MMC, go to:Certificates > Trusted Root Certification Authorities > CertificatesRight-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).
Subscribe to:
Posts (Atom)
Creating Solr core for sitecore using command prompt
We setup the solr cores using command “C:\solr8985\sc103solr-8.11.2\bin>solr.cmd create -c sitecore_sxa_web_index -d sitecore_configset” ...
-
You might have faced an error while making the container up using the up.ps1 script, and subsequently, when attempting to run docker compos...
-
This is one of the Sitecore templates to create the items but, When can we use this template? and How to create it? Well, the...
-
Follow the below step to resolve the issue shown in the SS below: docker network ls docker network rm <network id of sxastarter_default...