Created
July 6, 2022 15:47
-
-
Save fluxdigital/24288afc177a615d798e6ce22414fb2f to your computer and use it in GitHub Desktop.
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
<# | |
Function used to move preview site to the top of the list | |
#> | |
function Move-Preview-Site-To-Top($newSiteId){ | |
$sxaSitesList = Get-Item -Path "master:/sitecore/system/Settings/Foundation/Experience Accelerator/Multisite/Management/Sites" | |
$orderValuesCurrent = $sxaSitesList.Fields["Order"].Value; | |
write-host "New Site ID: $($newSiteId)" | |
write-host "Current Order Values: $($orderValuesCurrent)" | |
if (![string]::IsNullOrEmpty($orderValuesCurrent) -and $newSiteId) | |
{ | |
$orderValues = "$($newSiteId)|$($orderValuesCurrent)" | |
$sxaSitesList.Editing.BeginEdit() | |
$sxaSitesList.Fields["Order"].value = $orderValues | |
$sxaSitesList.Editing.EndEdit() | |
write-host "New Order Values Set: $($orderValues)" | |
} | |
else{ | |
write-host "New Order Value Not Set: $($orderValuesCurrent)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment