What's the best practice for using Include vs Render for snippets in landing pages?

What's the best practice for using Include vs Render for snippets in landing pages?

Michael_Buglio
Tourist
13 0 2

I have a landing page that customize for each school we sell to.  The landing page template currently has the following:

{% assign SchoolName = page_title %}
{% include SchoolName %}

 

and that renders a snippet named for the school.  I create a snippet with the school name and custom information.

 

If I use {% render SchoolName %}

it does not work because render doesn't like variables.

 

Is there a better/not deprecated/best practice way to do this?

 

My snippets have a little bit of JS which work as snippets but not if I fully customize the landing page

 

Reply 1 (1)

ScalaApps
Shopify Partner
66 2 11

In our experience using includes may cause performance issues with shopify embedded app blocks.

We run an automated check in one of our apps to detect a popular script that uses "include" instead of "render" that may cause bugs to our app.

You can still use variable with render, is just that you have to follow this syntax:

 

 {% render 'liquidfile', variable: "yourvalue" %}

 

Scala Apps



- If you find my reply helpful, please hit Like and Mark as Solution

- Se você achar minha resposta útil, por favor clique em Curtir e Marcar como Solução

Parcelamento/Installments | Hide sold variants | Apps | Blog