Finding the Content Type name

Previously, for templates that were shared across multiple content types, I’d compare content type IDs (which can possibly change when you deploy to another server) or make a database call to load a content type name from the repository (lots of unnecessary processing time spent).

In order to avoid these pitfalls, I found that you can instead do this:

$sys.item.getDefinition().getInternalName()

If you prefer the user-visible name, you could do this, instead:

$sys.item.getDefinition().getLabel()