in

How to Create a Last Modified Report per Page in Sitecore

In large Sitecore implementations, content changes happen constantly as editors update text, swap components, or upload new images. Tracking when a page was last modified, including updates to linked components and media assets, helps teams maintain content freshness and audit what’s new.

This tutorial explains how to build a Last Modified Report per Page using Sitecore PowerShell Extensions (SPE) and Sitecore APIs.

Why This Report Matters

Knowing when content was last updated helps:

  • Identify outdated pages that need attention
  • Support SEO freshness by validating last modification timestamps
  • Audit recent publishing activity
  • Align with content governance and QA workflows

However, Sitecore’s built-in __Updated field only tracks direct item edits. It doesn’t reflect updates from data sources or linked assets. That’s why this approach uses PowerShell reporting combined with logic to detect changes in related items.

Tools to Use in Sitecore

To create a complete modification report, you’ll use:

  1. Sitecore PowerShell Extensions (SPE) to query items and generate the report
  2. Sitecore API to read the __Updated and __Updated by fields
  3. Link Database and field parsing to detect related component data sources and media items

SPE is the best tool for this task because it can access item relationships, read timestamps, and export data directly into a CSV or Excel file.

Step 1: Open Sitecore PowerShell ISE

  1. Log in to Sitecore
  2. Go to Desktop → Development Tools → PowerShell ISE
  3. Select the Master database
  4. Create a new script

Step 2: Add the PowerShell Script

Paste this script into the editor:

$rootPath = "master:/sitecore/content/Home"
$results = @()

Write-Host "Generating last modified report for pages..." -ForegroundColor Cyan

$pages = Get-ChildItem -Path $rootPath -Recurse | Where-Object { $_.TemplateName -ne "Folder" }

foreach ($page in $pages) {
    $lastModified = [datetime]$page["__Updated"]
    $lastModifiedBy = $page["__Updated by"]

    # Check linked components (data sources)
    $renderings = $page["__Final Renderings"]
    if ($renderings) {
        $xml = $renderings
        $dsIds = $xml.LayoutDefinition.Devices.Device.Renderings.Rendering.datasource | Where-Object { $_ -ne "" }

        foreach ($id in $dsIds) {
            $dsItem = Get-Item -Path "master:" -ID $id -ErrorAction SilentlyContinue
            if ($dsItem) {
                $dsUpdated = [datetime]$dsItem["__Updated"]
                if ($dsUpdated -gt $lastModified) {
                    $lastModified = $dsUpdated
                    $lastModifiedBy = $dsItem["__Updated by"]
                }

                # Check for linked media assets
                foreach ($field in $dsItem.Fields) {
                    if ($field.Type -eq "Image" -or $field.Type -eq "File") {
                        $mediaId = $field.Value
                        if ($mediaId -and $mediaId.StartsWith("{")) {
                            $mediaItem = Get-Item -Path "master:" -ID $mediaId -ErrorAction SilentlyContinue
                            if ($mediaItem) {
                                $mediaUpdated = [datetime]$mediaItem["__Updated"]
                                if ($mediaUpdated -gt $lastModified) {
                                    $lastModified = $mediaUpdated
                                    $lastModifiedBy = $mediaItem["__Updated by"]
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    $results += [pscustomobject]@{
        PagePath       = $page.Paths.FullPath
        PageName       = $page.Name
        LastModified   = $lastModified
        ModifiedBy     = $lastModifiedBy
    }
}

$results | Sort-Object LastModified -Descending | Export-Csv -Path "C:\SitecoreLastModifiedReport.csv" -NoTypeInformation
Write-Host "Report saved to C:\SitecoreLastModifiedReport.csv" -ForegroundColor Green

Step 3: What the Script Does

  • Scans all pages under the specified root path
  • Captures each page’s last updated timestamp and user
  • Parses the __Final Renderings field to find linked component data sources
  • Checks those data sources for newer modification timestamps
  • Inspects image or file fields in components for updated media assets
  • Writes results to a CSV file sorted by the most recent updates

Step 4: Review the Output

After running the script, open C:\SitecoreLastModifiedReport.csv. Each row includes:

Page PathPage NameLast ModifiedModified By
/sitecore/content/HomeHome2025-11-10sitecore\editor1
/sitecore/content/Home/NewsNews2025-11-08sitecore\admin

This report provides a full audit trail of what pages were recently updated, whether directly or through component or media changes.

Step 5: Schedule or Automate the Report

You can make this report recurring by:

  • Saving the script as a PowerShell Report Item in /sitecore/system/Modules/PowerShell/Script Library/Reports
  • Using the Task Scheduler in Sitecore to run it nightly or weekly
  • Sending the report to an email list for editors or managers

Best Practices

  • Run the script on the Master database to capture real authoring activity
  • Avoid running it on the entire /sitecore/content tree for performance reasons
  • Add filters for specific templates (for example, Page templates only)
  • Include __Revision data if you need version-level auditing

Conclusion

Using Sitecore PowerShell Extensions is the most efficient way to generate a Last Modified Report per Page. Unlike the basic __Updated field, this method accounts for component-level and asset updates, giving you a more accurate view of what’s truly changed.

This approach supports better governance, SEO content freshness, and transparency across editorial teams while being simple to implement.

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

How to Manage and Update Robots.txt in Sitecore for Test and Subdomain Environments

Essential Sitecore Bookmarklets for Content Editors and Authors