Skip to content

Instantly share code, notes, and snippets.

@Wesley-Lomax
Last active March 23, 2018 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wesley-Lomax/2dfd65cb7545a8e2f37e4c3e9972d57f to your computer and use it in GitHub Desktop.
Save Wesley-Lomax/2dfd65cb7545a8e2f37e4c3e9972d57f to your computer and use it in GitHub Desktop.
List all Sitecore items where template is in a predefined list and location in the content tree, display in ListView
<#
SYNOPSIS
Does a simple count of all items in the specified templates
INSTRUCTIONS
After Get-Item -Path, type the path of the parent you want to start with.
EX: master:\sitecore\content\sites\example
Put the same path after Get-ChildItem, which will crawl through and find all child pages.
#>
$templateIds = @(
"{051B751D-F6CE-400E-BE22-F5CE61DA3C35}", <# Specialist product landing page #>
"{5451754D-14EC-4E86-BDEB-35D2978B8AB8}", <# Specialist product listing page #>
"{DB5B73EF-F140-4F25-B14A-278AF020C5B6}", <# Transactional landing page #>
"{41AAB73D-C936-4658-A555-4D3944D90E72}", <# Transactional landing page (201605110) #>
"{3432672A-D6BE-4B08-A0DB-BBC5C726468D}", <# Category Landing Page (20160511) #>
"{2743C212-DD83-4B9E-ABB8-39D744D6738D}", <# Category Landing Page x 2 #>
"{79CC8C84-ABC0-458E-8A19-DAD9EE32E80E}", <# Category Landing Page x 3 #>
"{B6E873AB-9C34-4575-A2B9-96E2F7BE1703}", <# Category Landing Page x 4 #>
"{289A10FD-71C8-457B-8735-1A28D0BEEE89}", <# Landing page #>
"{D6A18312-67CB-4F26-98DE-B714B7E69594}", <# Rich landing page #>
"{7AF33A1B-5641-4A8D-9E4E-BC36A15A64EB}" <# Alternate landing page #>
)
@(Get-Item -Path master:\content\home) + @(Get-ChildItem -Path master:\content\home -Recurse) |
Where-Object { $templateIds -eq $_.TemplateId -and $_.Versions.GetVersions($true).Count -ne 0 -and $_.Language -eq "en-GB"} |
Show-ListView -Property ID, Name, TemplateName, @{Label="Path"; Expression={$_.Paths.FullPath} }, @{Label="Languages"; Expression={$_.Languages | % { $_.Name + ", "}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment