I wanted to get an overview of all the templates in a Sitecore project along with how many times each has been used.
I thought there might be some marketplace module for doing this but couldn’t find one, nor could I find a suitable report in the ASR module.
So I wrote a little aspx script to write this out, hopefully it will be useful to someone:
<%@ Page Language="C#" AutoEventWireup="true" %><%
Response.ContentType = "text/csv";
var db = Sitecore.Data.Database.GetDatabase("master");
var templates = db.GetItem("/sitecore/templates/User Defined");
foreach (var template in templates.Axes.GetDescendants())
{
if (template.TemplateName == "Template")
{
var usage = Sitecore.Globals.LinkDatabase.GetReferrerCount(template);
if (template.Children["__Standard Values"] != null)
usage--;
Response.Write(template.ID + "," + template.Paths.Path + "," + usage + "," + Environment.NewLine);
}
}
%>
Hello blogger, i must say you have high quality articles here.
Your website can go viral. You need initial traffic only.
How to get it? Search for: Mertiso’s tips go viral