The template object has a handful of attributes.

template.name

Returns the template's name without the template's custom suffix, if it exists, or the .liquid extension.

<!-- If you're on the product.liquid template -->
{{ template.name }}
product

template.type

Returns the template's type name. e.g. index, product, collection, cart, order.

<!-- If you're on the product.liquid template -->
{{ template.type }}
product