0
不循環我有一個名爲gallery.yml
一個在我的哲基爾的項目稱爲/_data
文件夾中的頁面,我想通過組迴路gallery.yml
並在一個新的頁面輸出的/_includes
。數據/ YAML環路傑基爾
gallery.yml
:
- name: Banana Shortcake
color: yellow
weight: 2 lbs
- name: Chocolate Mousse
color: brown
weight: 9 lbs
rogue-item: Yum!
- name: Strawberry Fluff
color: pink
weight: 0.5 oz
的.html
頁面/_includes
:
{% for gallery in site.data.gallery %}
<h1>{{ gallery.name }}</h1><!-- This should be Banana Shortcake -->
<p>The color of {{ gallery.name }} is {{ gallery.color }}, and its weight is {{ gallery.weight }}</p>
<h1>{{ gallery.name }}</h1><!-- This should be Chocolate Mousse -->
<p>The color of {{ gallery.name }} is {{ gallery.color }}, and its weight is {{ gallery.weight }}</p>
<p>Rating: {{ gallery.rogue-item }}</p>
<h1>{{ gallery.name }}</h1><!-- This should be Strawberry Fluff -->
<p>The color of {{ gallery.name }} is {{ gallery.color }}, and its weight is {{ gallery.weight }}</p>
{% endfor %}
但是當我申請這個,沒有循環 - 它只是重複了第一組。任何提示,我要去哪裏錯了?
我明白了!謝謝! – bunnycode