3

我们在功能区发布-> 更改中有选项,但这不是取消发布子项。

我们如何在 sitecore 中为一种特定语言取消发布项目及其子项目?

谢谢

4

3 回答 3

4

Approach 1: In the Publish ribbon, click the Change button and UNCHECK Publishable on the Item tab. Now delete the parent item with sub-items and the item will be removed from the published DB. Next go back to the item and CHECK Publishable, then publish the item only in the language you want.

Approach 2: Use the database selector in the Sitecore shell (bottom right corner) and select your publishing target DB (e.g. "web"). GO into that tree, find the item in the language and delete that version. After that you'll need to go to your public site's cache page and clear that cache manually: http://host/sitecore/admin/cache.aspx

Approach 3: Delete the item in the master DB, publish the parent, restore it form the recycle bin, publish it again live but not in the language you don't want.

于 2013-07-17T12:55:22.603 回答
0

我做了这个

  function GetItemDatasources {
    [CmdletBinding()]
    param([Item]$Item)
  
    # grab all datasources that are not header and footer elements
    return Get-Rendering -Item $item -FinalLayout -Device (Get-LayoutDevice -Default) |
        Where-Object { -not [string]::IsNullOrEmpty($_.Datasource)} |
        Where-Object { $_.Placeholder -ne 'Above Page Content' } |
        Where-Object { $_.Placeholder -ne 'Below Page Content' } |
        ForEach-Object { Get-Item "$($item.Database):" -ID $_.Datasource }
        # ForEach-Object { Write-Host ($_ | Format-List | Out-String) }
}
  
$location = get-location
  
$languages = Get-ChildItem "master:\sitecore\system\Languages"
$currentLanguage = [Sitecore.Context]::Language.Name
  
$langOptions = @{};
  
$actions = @{};
$actions["Unpublish"] = "1";
$actions["Publish"] = "";
  
foreach ($lang in $languages) {
    $langOptions[$lang.Name] = $lang.Name
}
  
$result = Read-Variable -Parameters `
    @{ Name = "destinationLanguages"; Title="Language(s) for publich/unpublish"; Options=$langOptions; Editor="checklist"; },
    @{ Name = "includeSubitems"; Value=$false; Title="Include Subitems"; Columns = 4;},
    @{ Name = "action"; Value="1"; Title="Action"; Options=$actions; Tooltip="Unpublish: Set language as unblishded on all langauge vestions.<br>Publish: Set language as publishded on all langauge vestions."; }`
    -Description "Select languages that should be proceed during updates" `
    -Title "Language Publish - Unpublish" -Width 650 -Height 660 -OkButtonName "Proceed" -CancelButtonName "Cancel" -ShowHints
  
if($result -ne "ok") {
    Exit
}
  
Write-Host "destinationLanguages = $destinationLanguages"
  
$items = @()
  
$items += Get-Item $location
  
# add optional subitems
if ($includeSubitems) {
    $items += Get-ChildItem $location -Recurse
}
  
# Remove any duplicates, based on ID
$items = $items | Sort-Object -Property 'ID' -Unique
  
$items | ForEach-Object { Write-Host ($_.ItemPath | Sort-Object | Format-List | Out-String) }
  
$message = "You are about to publish/unpublish <span style='font-weight: bold'>$($items.Count) item(s)</span> with the following options:<br>"
$message += "<br><table>"
$message += "<tr><td style='width: auto'>Languages:</td><td>$destinationLanguages</td></tr>"
$message += "<tr><td style='width: auto'>Include Subitems:</td><td>$includeSubitems</td></tr>"
$message += "</table>"
$message += "<br><p style='font-weight: bold'>Are you sure?</p>"
  
$proceed = Show-Confirm -Title $message
  
if ($proceed -ne 'yes') {
    Write-Host "Canceling"
    Exit
}
  
Write-Host "Proceeding with execution"
  
$items | ForEach-Object { 
    $vitems = Get-Item $_.ID -Language $destinationLanguages -Version *
    $vitems | ForEach-Object {
        $_.Editing.BeginEdit()
        $_["__Hide version"] = $action
        $_.Editing.EndEdit()
    }
}
于 2022-01-21T10:40:10.797 回答
0

一些脚本也很好:) 使用后发布站点

 function GetItemDatasources {
    [CmdletBinding()]
    param([Item]$Item)
  
    # grab all datasources that are not header and footer elements
    return Get-Rendering -Item $item -FinalLayout -Device (Get-LayoutDevice -Default) |
        Where-Object { -not [string]::IsNullOrEmpty($_.Datasource)} |
        Where-Object { $_.Placeholder -ne 'Above Page Content' } |
        Where-Object { $_.Placeholder -ne 'Below Page Content' } |
        ForEach-Object { Get-Item "$($item.Database):" -ID $_.Datasource }
        # ForEach-Object { Write-Host ($_ | Format-List | Out-String) }
}
  
$location = get-location
  
$languages = Get-ChildItem "master:\sitecore\system\Languages"
$currentLanguage = [Sitecore.Context]::Language.Name
  
$langOptions = @{};
  
foreach ($lang in $languages) {
    $langOptions[$lang.Name] = $lang.Name
}
  

$result = Read-Variable -Parameters `
    @{ Name = "destinationLanguages"; Title="Language(s) for clean up "; Options=$langOptions; Editor="checklist"; },
    @{ Name = "includeSubitems"; Value=$false; Title="Include Subitems"; Columns = 4;} `
    -Description "Select an  languages that should be cleanup" `
    -Title "Cleanup Language" -Width 650 -Height 660 -OkButtonName "Proceed" -CancelButtonName "Cancel" -ShowHints
  
if($result -ne "ok") {
    Exit
}
  
Write-Host "destinationLanguages = $destinationLanguages"
  
$items = @()
  
$items += Get-Item $location
  
# add optional subitems
if ($includeSubitems) {
    $items += Get-ChildItem $location -Recurse
}
  
# Remove any duplicates, based on ID
$items = $items | Sort-Object -Property 'ID' -Unique
  
$items | ForEach-Object { Write-Host ($_.ItemPath | Sort-Object | Format-List | Out-String) }
  
$message = "You are about to cleanup <span style='font-weight: bold'>$($items.Count) item(s)</span> with the following options:<br>"
$message += "<br><table>"
$message += "<tr><td style='width: auto'>Languages:</td><td>$destinationLanguages</td></tr>"
$message += "<tr><td style='width: auto'>Include Subitems:</td><td>$includeSubitems</td></tr>"
$message += "</table>"
$message += "<br><p style='font-weight: bold'>Are you sure?</p>"
  
  
$proceed = Show-Confirm -Title $message
  
if ($proceed -ne 'yes') {
    Write-Host "Canceling"
    Exit
}
  
Write-Host "Proceeding with execution"
  
$items | ForEach-Object { Remove-ItemVersion -Item $_ -Language $destinationLanguages -ExcludeLanguage "en*" }
于 2022-01-20T15:05:05.537 回答