-
|
I'm trying to specify the name of a global data file in frontmatter. It looks like this: ---
kingdom: insects
---{% for animal in kingdom %}
{{ animal.name }}
{% endfor %}Here How can I insert the value of One thing to clarify: I'm not trying to create pages from data. I'm just trying to display data on pages. Also, this is Nunjucks, if that matters. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
@freshyill I can think of two possible solutions:
|
Beta Was this translation helpful? Give feedback.
@freshyill I can think of two possible solutions:
You could keep your structure as-is, and probably use
eleventyComputedto dynamically resolvekingdomfrom the /_data/ directory, like so:Possibly better ways of doing that. I sometimes find JavaScript frontmatter confusing, but it works.
Slight tweak to your /_data/ directory, but if you move the insects.json file into a subfolder, like /_data/dynamic/insects.json, you can reference it dynamically like so: