Q: There are thousands of pages on the site, and there are thousands of pages with the same broken link, which needs to be replaced with the correct one. How can you do this quickly and efficiently?
A: First of all, we will certainly consider the way this action is implemented,
1, simple cumbersome manual one page modification
2, through the Writing program extension implementation
3. Sitecore PowerShell
Square One certainly is excluded undesirable, method two actually also can realize, but I think I want to consider the method three, before I have never contacted, through this demand also learn the PowerShell syntax.
The final implementation of the code is as follows:
function Getalllanguageversions ($item) { Get-item $item. Providerpath-language "ZH-CN"} function Processitem ($item) { $html = $item. fields["MyField"]. Value-replace "http://www.baidu.com", "http://www.cnblogs.com/wem520" $item. Editing.beginedit () $item. fields["MyField"]. Value= $html $item. Editing.endedit () } $itemsToProcess = Get-childitem-path "/sitecore/content/home" | foreach {getalllanguageversions ($_)}if ($itemsToProcess-ne $null) { $itemsToProcess | foreach {Processitem ($_)}}
Sitecore Powershell Bulk replaces richtext field contents