Add Sitecore Content Editor ribbon button to show page components

Posted 25 Mar 2025 by Marek Musielak

sitecore content editor ribbon button to show page components

One of our clients asked us if we could add an additional Sitecore Content Editor button near the Presentation Details link that would allow users to see all the components, their placeholders, and datasources on one screen, and moreover, that would provide Sitecore Content Editor deep links to both rendering and datasource items. I followed the steps below in order to create a ribbon button with Sitecore Powershell Extensions.

I wrote this blog post while working for Blastic, a company that delivers great Sitecore solutions and much more.

You don't even need to start Visual Studio. Log in to the Sitecore backend and open Sitecore Content Editor. Then follow the steps:

  • Add a new PowerShell Script Module Folder item under /sitecore/system/Modules/PowerShell/Script Library/SPE called Customizations.
  • Add a new PowerShell Script Module item under the folder item created earlier, call it Ribbon and check the Enabled checkbox.
  • Then use the PowerShell Script Library template to create 4 items under the Ribbon item: /sitecore/system/Modules/PowerShell/Script Library/SPE/Customizations/Ribbon/Content Editor/Ribbon/Presentation/Layout.
  • And finally, use the PowerShell template to create the Renderings item.
  • On Renderings items, set the Enable Rule field to where the item has a layout and paste the script below into the Script body field. Your structure should look like this:
  • sitecore content editor ribbon button to show page components - structure

$device = Get-LayoutDevice -Default
$renderings = Get-Rendering -Item $SitecoreContextItem -Device $device -FinalLayout
$data = @()

foreach ($rendering in $renderings) {
    if ($rendering.ItemID -ne $null) {
        $renderingItem = $null
        $datasourcePath = $null
        $datasourceId = $null
        $renderingPath = $null
        $renderingId = $null

        $renderingItem = Get-Item master: -ID $rendering.ItemID -ErrorAction Ignore
        if ($renderingItem -ne $null) {
            $datasource = $null

            if (![String]::IsNullOrEmpty($rendering.Datasource)) {
                $guid = [System.Guid]::empty
                
                if ([System.Guid]::TryParse($rendering.Datasource,[System.Management.Automation.PSReference]$guid)) {
                    $datasource = Get-Item -Path ("master:\" + $rendering.Datasource)
                } else {
                    $datasource = $SitecoreContextItem.Axes.SelectSingleItem($rendering.Datasource)
                }

                $datasourcePath = $datasource.Paths.FullPath
                $datasourceId = $datasource.ID.ToString()
            }

            $renderingId = $renderingItem.ID.ToString()
            $renderingPath = $renderingItem.Paths.FullPath
        }

        $data += @{
            Rendering = "<a href='/sitecore/shell/Applications/Content%20Editor.aspx?fo=$renderingId'>$renderingPath</a>"
            Placeholder = $rendering.Placeholder
            DatasourcePath = "<a href='/sitecore/shell/Applications/Content%20Editor.aspx?fo=$datasourceId'>$datasourcePath</a>"
        }
    }
}

$data | Show-ListView -Property `
    @{Label="Rendering"; Expression={$_.Rendering} },
    @{Label="Placeholder"; Expression={$_.Placeholder} },
    @{Label="Datasource"; Expression={$_.DatasourcePath} }

Close-Window


Go back to the Sitecore Launchpad and start the PowerShell ISE application. Switch to the SETTINGS tab, click on the down arrow near Rebuild All... and choose Sync Library with Content Editor Ribbon option:

sitecore content editor ribbon button to show page components - sync

Switch back to the Sitecore Content Editor and select any item with a layout. On the PRESENTATION ribbon, you should now see a new button called Renderings. Click on it and you will see a list like this one:

sitecore content editor ribbon button to show page components - result

Both Rendering and Datasource columns contain links which you can open in a new browser tab to deep link directly to that item in the Sitecore Content Editor.

To summarize, the custom ribbon button I’ve added enhances the Sitecore Content Editor by giving users quick access to all components, placeholders, and datasources, with deep links to relevant items. This solution, implemented with Sitecore PowerShell Extensions, makes the content management process easier.

Comments? Find me on or Sitecore Chat