在循环检查 cupcakesTest 文件夹的内容时遇到问题。我需要使用 for 循环

Having problems to loop through the contents of the cupcakesTest folder. I need to use the for loop

cupcakesTest 是一个包含 2 个降价文件的文件夹。 (纸杯蛋糕的描述)。
它位于项目文件夹中。

---
layout: post
title: Muffins
---
<h1>Our Cupcakessssss</h1>

<div class="cupcakes">

  {{ site.cupcakesTest }}

  {% for cupcake in site.cupcakesTest %}
    <div class="cupcake">
      <div class="image"><img src="{{ cupcake.image_path }}"/></div>
      <h2>{{ cupcake.type }}</h2>
    </div>    
  {% endfor %}

</div>

site.cupcakesTest 有效:

  • "directory" 应以下划线开头:(_cupcakesTest/)
  • 并作为 collection 添加到您的 _config.yml

    # _config.yml
    
    collections:
      - cupcakesTest