EPiServer Page Type usage report

Do you have a lot of page types in an EPiServer project and a gut feeling some of the are not used?

Quite common if you migrate a project from EPiServer CMS 4 that are based on the EPiServerSample project or if you inherit a project based on one of the new Public or Demo templates.

SQL Query for Page Type usage

SELECT
  pt.Name,
  pt.Filename,
  COUNT(p.pkID) AS Antal
FROM
  tblPage AS p RIGHT OUTER JOIN
  tblPageType AS pt ON p.fkPageTypeID = pt.pkID
GROUP BY
  pt.Name, pt.Filename, pt.SortOrder
ORDER BY
  pt.SortOrder

Before you run this query, remember to empty your recycle bin and also check that your pageRootId in web.config. If it is not equal to one there can be a lot of hidden pages in your database.

Bookmark and Share
  1. Steve Celius’s avatar

    Nice one! Quick and easy to do.

    Btw. the PageTypeUtil module on EPiCode also shows how many pages a given page type has, and you even have the option to delete all pages of a given page type (or optionally get a list of the page id’s to see if the pages are just test or demo pages.)

    I’m planning on expanding the existing PageTypeUtil to report how many pages uses a given property on a given page type. Nice if you want to make your site as clean as possible before migration from v4 to v5.

    /Steve

    Reply

  2. Petter’s avatar

    Love it!

    Now if just everything in life was this simple.

    Thanks

    /Petter

    Reply