If want to know How many times is each rendering used for a specific website. You can use the below Powershell Script with more information for each rendering.
- Open PowerShell ISE (You can found this in /sitecore/shell/ menu, Development Tools, PowerShell ISE
- Copy past the script below.
- Save as "How many times is each rendering used for a specific website" below Script Library/SPE/Reporting/Content Reports/Reports/Solution Audit
<#
.SYNOPSIS
How many times is each rendering used in your solution?
.NOTES
copy from www.stockpick.nl
#>
Import-Function Render-ReportField
filter IsRendering {
# Look for Controller and View renderings
$renderingIds = @("{2A3E91A0-7987-44B5-AB34-35C2D9DE83B9}","{99F8905D-4A87-4EB8-9F8B-A9BEBFB3ADD6}")
if(($renderingIds -contains $_.TemplateID)) { $_; return }
}
$database = "master"
# Renderings Root
$renderingsRootItem = Get-Item -Path "$($database):{32566F0E-7686-45F1-A12F-D7260BD78BC3}"
$websiteRootItem = Get-Item -Path "$($database):{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}"
$props = @{
Parameters = @(
@{Name="websiteRootItem"; Title="Choose the report root"; Tooltip="Only items from this root will be returned."; }
)
Title = "Items With Component Report"
Description = "Choose the website for the report."
Width = 650
Height = 250
ShowHints = $true
Icon = [regex]::Replace($PSScript.Appearance.Icon, "Office", "OfficeWhite", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
}
$result = Read-Variable @props
if($result -eq "cancel") {
exit
}
$items = $renderingsRootItem.Axes.GetDescendants() | Initialize-Item | IsRendering
$reportItems = @()
foreach($item in $items) {
$count = 0
$websitecount = 0;
$referrers = Get-ItemReferrer -Item $item
if ($referrers -ne $null) {
$count = $referrers.Count
foreach($ref in $referrers) {
if ($ref.ItemPath.StartsWith($websiteRootItem.ItemPath)) {
$websitecount++
}
}
}
$reportItem = [PSCustomObject]@{
"Icon" = $item."__Icon"
"Name"=$item.Name
"UsageCount"=$count
"WebsiteCount" = $websitecount
"ItemPath" = $item.ItemPath
"TemplateName" = $item.TemplateName
"Controller" = $item.Controller
}
$reportItems += $reportItem
}
$reportProps = @{
Property = @(
"Icon",@{Name="Rendering Name"; Expression={$_.Name}},
@{Name="Total Number of usages"; Expression={$_.UsageCount}},
@{Name="Number of usages below: "+$websiteRootItem.Name.ToString(); Expression={$_.WebsiteCount}},
"ItemPath",
@{Label="Rendering Type"; Expression={$_.TemplateName} },
"Controller"
)
Title = "Custom rendering report"
InfoTitle = "Available Renderings"
InfoDescription = "Count of references for each rendering. Results include only MVC Controller and View renderings.for" + $websiteRootItem.ItemPath.ToString()
}
$reportItems |
Sort-Object WebsiteCount -Descending |
Show-ListView @reportProps
Close-Window
Reference and Credit : https://www.stockpick.nl/english/how-many-times-is-each-rendering-used-for-a-specific-website/
Hope it helps!