Thursday, 11 September 2014

Get Usage report of Content Types in Optimizely CMS

Large Optimizely or EPiServer projects tend to collect old page types over time. New templates are introduced, editors move on to newer content types, and some older page types quietly stop being used.

If you are cleaning up a long-running CMS solution, one of the first things worth checking is which page types are still in use and which ones have a page count of zero.

The SQL query below gives you a quick usage report for page types. It does not cover block types, but it is a useful first step when auditing legacy CMS projects.

Quick SQL Audit

Run the following query in SQL Server to list page type names, filenames, and the number of pages using each type:

SELECT
    pt.Name,
    pt.Filename,
    COUNT(p.pkID) AS PageCount
FROM tblPageType AS pt
LEFT JOIN tblPage AS p
    ON p.fkPageTypeID = pt.pkID
GROUP BY
    pt.Name,
    pt.Filename
ORDER BY
    PageCount DESC,
    pt.Name;

Why This Is Useful

This report helps you quickly spot:

  • page types that are heavily used
  • page types that are rarely used
  • page types with a PageCount of 0, which may be candidates for cleanup

Before You Run It

Empty the recycle bin first. Deleted content can still affect the result and make unused page types look active when they are not.

Important Note

A page count of zero is a strong signal, but it should not automatically mean “safe to delete”. Before removing a page type from code, double-check whether it is still referenced by old templates, import jobs, migrations, or content type availability rules.

For older self-hosted EPiServer or Optimizely CMS solutions, this is a quick and practical way to start a cleanup exercise without building a custom report first.

About the Author

Adnan Zameer, Principal Developer at Optimizely UK, is a certified Microsoft professional, specializing in web app architecture. His expertise includes Optimizely CMS and Azure, showcasing proficiency in crafting robust and efficient solutions.

0 comments :

Post a Comment