Skip to content

Instantly share code, notes, and snippets.

@TeamDijon
Last active July 12, 2024 13:59
Show Gist options
  • Save TeamDijon/21f1e8cddde44b42b74a5c84bb7b93e6 to your computer and use it in GitHub Desktop.
Save TeamDijon/21f1e8cddde44b42b74a5c84bb7b93e6 to your computer and use it in GitHub Desktop.
{%- comment -%}
Renders the template name based on the template object.
Accepts:
- template {Template object} - Template object
Usage:
<body class="{% render 'template-name', template: template -%}">...</body>
{%- endcomment -%}
{% liquid
assign template_name = 'template-' | append: template.name
if template.suffix
assign template_name = template_name | append: ' ' | append: template_name | append: '-' | append: template.suffix
endif
echo template_name
%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment