Created
June 16, 2019 19:05
-
-
Save AdamNaj/282ed9339252bb0614f3845c55f09aeb to your computer and use it in GitHub Desktop.
Ret Rendering Variant Roots for all sites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-HostProperty -HostWidth 5000 | |
$roots = @()+[Sitecore.Sites.SiteManager]::GetSites() | ? { $_.Properties['IsSxaSite'] } | % { $_.Properties['rootPath'] }; | |
foreach ($root in $roots) { | |
$site = New-Object -TypeName PSCustomObject | |
Add-Member -InputObject $site -Name 'path' -Value $root -MemberType NoteProperty | |
$variants = New-Object -TypeName PSCustomObject | |
Add-Member -InputObject $site -Name 'variants' -Value $variants -MemberType NoteProperty | |
$variantFolders = gci "master:$($root)/Presentation/Rendering Variants" | select Name, @{Name = "Path"; Expression={$_.paths.Path}} | |
foreach($variantFolder in $variantFolders){ | |
Add-Member -InputObject $variants -Name $($variantFolder.Name) -Value $variantFolder.Path -MemberType NoteProperty | |
} | |
$site | ConvertTo-Json | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment