0
我正在使用Twig PatternLab。JSON沒有替換變量
我得到了一個小問題與JSON和一個樹枝for循環。
凌00-H3-black.twig:
<h3 class="A-ChevronBlack"><a href="">{{ text.chevron }}</a></h3>
分子00 mastertile.twig:
<div class="M-DMasterTile">
<div class="image"></div>
<div class="content">
{% include "atoms-h3-black" %}
</div>
</div>
生物00 default2.twig:
{% for post in default2 %}
{% include "molecules-mastertile" %}
{% endfor %}
和JSON inside Organism folder 00-default2.json
{
"default2" : [
{
"text" : {
"chevron" : "How to build a campfire",
"body" : "This is the body copy"
}
},
{
"text" : {
"chevron":"Lorem Ipsum",
"body" : "This is the body copy"
}
}
]
}
我的期望是「default2」循環兩次,因爲我有一個JSON中有兩個項目的數組,並推送JSON內容。如果我從JSON數組中取出變量,它會顯示更改(但顯然是重複的)。
我在這裏做錯了什麼?
我感謝你的幫助