How Can I render a snippet this name is defined by a variable?

Highlighted
Shopify Partner
6 0 0

I want to render a snippet this name is defined by a variable.

 

 

{% assign template_name = 'page-' | append: page.template_suffix %}
{% render template_name %}

But it occurs error that show "Syntax error in tag 'render' - Template name must be a quoted string".

 

"include" tag can render a snippet this name is defined by a variable.

 

Why "render" tag can't do it?

 

0 Likes
Highlighted
Shopify Partner
1458 174 268

Unfortunately, render doesn't accept dynamic names, most probably by design and taking into consideration the performance impact. 

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
Highlighted
New Member
1 0 0

Well, that's a bummer! This would have saved me from having to create a bunch of individual templates. 😫

0 Likes