You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe that's not the good way to do this but I'm trying to gather the maximum of settings from the project in a _data/settings.json so that the end user could customize without digging through different files and folders.
So I have created this json file, here is a sample:
In a index.njk template I'd like to use the imagesPerPage parameter in the frontmatter:
---
layout: default
pagination:
data: itemsCollection
size: {{ settings.imagesPerPage }}
reverse: true
permalink: "{% if pagination.pageNumber > 0 %}{{ pagination.pageNumber + 1 }}/{% endif %}index.html"
---
<section class="items">
{% for item in pagination.items %}
{% include 'item.njk' %}
{% endfor %}
</section>
{% include 'pagination.njk' %}
When I manually enter a value in size: it works well.
But trying to use an info from the settings.json does not work.
I've tried a dozen of different syntax so I wonder: is this even possible? Or am I thinking this wrong?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Maybe that's not the good way to do this but I'm trying to gather the maximum of settings from the project in a
_data/settings.json
so that the end user could customize without digging through different files and folders.So I have created this json file, here is a sample:
In a index.njk template I'd like to use the
imagesPerPage
parameter in the frontmatter:When I manually enter a value in
size:
it works well.But trying to use an info from the settings.json does not work.
I've tried a dozen of different syntax so I wonder: is this even possible? Or am I thinking this wrong?
Any tip would be welcome. THanks
Beta Was this translation helpful? Give feedback.
All reactions