Liquid 用11ty循环子目录中的项

Liquid 用11ty循环子目录中的项,liquid,eleventy,Liquid,Eleventy,使用以下目录结构,我需要遍历子目录中的项: |_ _includes |_ _site |_ books |_ book-one |_ index.html |_ sections |_ section-one |_ index.html |_ chapters |_ index.html |_ chapter-one.html

使用以下目录结构,我需要遍历子目录中的项:

|_ _includes
|_ _site
|_ books
   |_ book-one
      |_ index.html
      |_ sections
         |_ section-one
            |_ index.html
            |_ chapters
               |_ index.html
               |_ chapter-one.html
               |_ chapter-two.html
               |_ chapter-three.html
               |_ chapter-four.html
在上面的
第一节/index.html
中,应该循环并列出
章节
子目录中的项目

每个
chapter-x.html
都包含YAML前端内容,如:

---
title: This is the Title
layout: layouts/chapter.yaml
---
<p>Lorem ipsum dipity doo</p>
---
标题:这是标题
布局:布局/chapter.yaml
---
易卜生

还有我的版式

---
layout: layouts/master.liquid
---
<ol>
{%- for chapter in chapters -%}
  <li>{{ title }}</li>
{%- endfor -%}
</ol>
---
布局:布局/master.liquid
---
{%-对于章节中的章节-%}
  • {{title}}
  • {%-endfor-%}
    使用collections.all如何,它可以让您访问每一条内容?您可以编写代码,根据当前正在执行的页面对其进行解析,以查找子级。