Skip to content

Instantly share code, notes, and snippets.

View MartinMiles's full-sized avatar

Martin Miles MartinMiles

View GitHub Profile
param(
[string] $PlaceholderKey = "col-wide-2"
)
# 1) Load master database
$db = [Sitecore.Configuration.Factory]::GetDatabase("master")
if (-not $db) {
Write-Error "ERROR: Could not load the 'master' database."
exit 1
}
<#
.SYNOPSIS
Lists every item (and its template's Standard Values) that actually has
presentation details (shared and/or final layouts) beneath a chosen site root.
.PARAMETER SiteRoot
The content path to start from. Defaults to "/sitecore/content/Zont/Habitat/Home".
.PARAMETER DatabaseName
The Sitecore database to query (master/web/old/etc.). Defaults to "master".
<#
.SYNOPSIS
Download a page and parse Sitecore debug comments into a JSON hierarchy.
.DESCRIPTION
Scans a Sitecore-rendered HTML page for <!-- start-component='…' --> and <!-- end-component='…' -->
markers, extracts metadata (name, id, uid, placeholder, path), and reconstructs a nested
component-to-placeholder tree. Strict UID matching ensures proper pairing of start/end tags,
while allowing the root layout to remain on the stack at the end.