Need
We need to ability to expose arbitrary liquid tags from YML files within our middleman template.
If we had the the following in a YML file called customers.yml in the data directory.
customers:
- first_name: Ellery
last_name: Durgin
- first_name: John
last_name: Smith
and did the following in our index.liquid
<ul>
{% for customer in customers %}
<li>{{ customer.first_name }}</li>
{% endfor %}
</ul>
The expected output would be
<ul>
<li>Ellery</li>
<li>John</li>
</ul>
if the user defines a singular yml file.
user.yml
first_name: Ellery
last_name: Durgin
Creates the following template:
<h3> Welcome, {{user.first_name}} {{user.last_name}} </h3>
The expected output would be:
<h3> Welcome, Ellery Durgin</h3>
We would have 5-10 of these data files. This is going to be used to allow offline development of themes for our application. The current data model does not support our needs because it would require removing the data prefix from every entry. If arbitrary is not possible, we can predefine them if an example is provided.
#Edit
We figured it out. Turns out it was as simple as an entry in the config file
here is what we ended up doing
page '/', locals: { customers: @app.data.root.customers, user: @app.data.root.user }