The template object
The template
object has a handful of attributes.
Referencing just template
returns the name of the template used to render the current page, with the .liquid
extension omitted.
Input
<!-- If you're on the product.alternate.liquid template -->
{{ template }}
Output
product.alternate
template.directory
Returns the name of the template's parent directory. Returns nil
for templates whose
parent directory is the templates/
folder.
Input
<!-- If you're on the customers/login.liquid template -->
{{ template.directory }}
Output
customers
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.alternate.liquid template -->
{{ template.name }}
Output
product
template.suffix
Returns the name of the custom template without the template.name
prefix or the .liquid
extension. Returns nil
if a custom template is not being used.
<!-- If you're on the product.alternate.liquid template -->
{{ template.suffix }}
Output
alternate