Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables created inside an include are not passed into the nested include #26

Open
stewartknapman opened this issue Oct 28, 2014 · 1 comment
Labels

Comments

@stewartknapman
Copy link

I have a structure with nested includes like this:

File 1:

<div>
  {% assign foo = foo_object %}
  {% include 'file_2' %}
</div>

File 2:

<ul>
  {% for bar in foo.bars %}
    {% include 'file_3' %}
  {% endfor %}
</ul>

File 3:

<li>{{ bar.title }}</li>

I expect to see that bar.title is output from file 3. The include is working because I can see the li but bar is an empty object.

If I output bar.title inside file 2 it works fine.

@leizongmin leizongmin added the bug label Nov 23, 2014
@leizongmin
Copy link
Owner

you can try the following:

File 2:

<ul>
  {% for bar in foo.bars %}
    {% include 'file_3' bar=bar %}
  {% endfor %}
</ul>

@leizongmin leizongmin reopened this Aug 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants