I want to use Netlify CMS for my Jekyll site and I have this layout:
{% for skills in page.skills %}
<div class="guide-skill">
<div class="guide-skill-fill">
{% for i in (1..15) %}
<div class="{% if skills.levels contains i %}fill{% endif %} skill-check"><p>{{ i }}</p></div>
{% endfor %}
</div>
</div>
{% endfor %}
and the front matter of page that I write in text editor that uses this layout :
skills:
- levels:
- 1
the code works fine, the fill
class is added properly.
But when I use Netlify CMS with list widget, it returns string instead of number to the levels
list, like this :
skills:
- levels:
- '1'
So the code doesn't work, how to make it returns number?
What I've tried
- Quote the
i
, but it gave me an error - Use
valueType : "int"
, didn't work
My config
- label: "Hero Skills"
name: "skills"
widget: "list"
required: false
fields:
- {label: "Skill Number", name: "number", widget: "number"}
- {label: "Levels", name: "levels", widget: "list"}