Each page has an id
in frontmatter:
<code>---
title: How it Works
layout: page
id: howitworks
---
...
</code>
<code>---
title: How it Works
layout: page
id: howitworks
---
...
</code>
---
title: How it Works
layout: page
id: howitworks
---
...
I have a _config.yml
file:
<code>progressbar:
index:
- "firstIndex"
- "secondIndex"
- "thirdIndex"
howitworks:
- first
- second
- third
</code>
<code>progressbar:
index:
- "firstIndex"
- "secondIndex"
- "thirdIndex"
howitworks:
- first
- second
- third
</code>
progressbar:
index:
- "firstIndex"
- "secondIndex"
- "thirdIndex"
howitworks:
- first
- second
- third
I want to create an include
which loops through progressbar
and grabs each item from site.progressbar.{{page.id }}
For example:
<code><ul>
{% for thing in site.progressbar.{{ page.id }} %}
<li>{{ thing }}</li>
{% endfor %}
</ul>
</code>
<code><ul>
{% for thing in site.progressbar.{{ page.id }} %}
<li>{{ thing }}</li>
{% endfor %}
</ul>
</code>
<ul>
{% for thing in site.progressbar.{{ page.id }} %}
<li>{{ thing }}</li>
{% endfor %}
</ul>
Is this possible?
ps. I can change anything about the way this is done, including how _config.yml
is defined if it makes things easier.
Assuming I’m on page howitworks
I should see:
<code><ul>
<li>first</li>
<li>second</li>
<li>third</li>
</ul>
</code>
<code><ul>
<li>first</li>
<li>second</li>
<li>third</li>
</ul>
</code>
<ul>
<li>first</li>
<li>second</li>
<li>third</li>
</ul>