In our project we are creating static sitemap and need to exclude not publishable item from master sitemap. We need a way to find this detail at item level or do we need custom code to do that.

  • 2
    Why do you create sitemap from master database? Wouldn't it be easier to generate it based on web database content?
    – Marek Musielak
    Apr 5 at 19:06
  • Actually due to some reason we check sitemap of master and web, compare the pages which are missing on live site, so in this practice pages which are not publishable don't need to be include as it will unnecessary increase the list with unwanted pages
    – Rinku Jain
    Apr 7 at 11:23

2 Answers 2


Have you had the opportunity to test this script?

function IsItemPublishable($item) {
        if ($item -eq $null) {return $false}
        $targets = [Sitecore.Publishing.PublishManager]::GetPublishingTargets($item)
        $isPublishable = $targets | ForEach-Object {$_.CanPublishItem($item)}
        if (-not $isPublishable) {return IsItemPublishable $item.Parent}
        return $true
    $item = Get-Item -Path "master:" -ID "{0F333E30-B364-45D4-AC7A-7B758C34E5E4}"
    if ($item) {if (IsItemPublishable $item) {Write-Host "Item is publishable"} else {Write-Host "Item is not publishable"}} else {Write-Host "Item not found"}

We can achieve it using isPublishable method, e.g.

$i = get-item "{0F333E30-B364-45D4-AC7A-7B758C34E5E4}" | select -property "publishing" 
if ($i.Publishing.isPublishable([datetime]::now ,$true))
{write-host "Item is publishable"}
else {write-host "Item is not publishable"}

So we can chip in our code based on this method result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.