Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ret Rendering Variant Roots for all sites
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
You can’t perform that action at this time.