Jekyll 使用“时如何访问元数据”;其中;滤波器

Jekyll 使用“时如何访问元数据”;其中;滤波器,jekyll,Jekyll,我在一个集合中有一组结构化的页面,其结构如下所示: chapter1 section1 section2 section3 chapter2 section1 section2 section3 chapter3 section1 section2 section3 每个页面都是一个单独的页面,呈现自己的永久链接 假设我想链接到第3章/第1节,我该怎么做?我想使用Liquidwherefilter,但这似乎给了我页面内容,而不是元数据 {%

我在一个集合中有一组结构化的页面,其结构如下所示:

chapter1
   section1
   section2
   section3
chapter2
   section1
   section2
   section3
chapter3
   section1
   section2
   section3
每个页面都是一个单独的页面,呈现自己的永久链接

假设我想链接到第3章/第1节,我该怎么做?我想使用Liquid
where
filter,但这似乎给了我页面内容,而不是元数据

{% assign section_post = site.chapters | where:"url","chapter3/section1" %}
{{ section_post }}
这让我得到了正确的页面,但不是正确的内容。如果我在版面中写下这些,我什么也得不到:

<a href="{{ section_post.permalink }}">{{ section_post.title }}</a>


我做错了什么?如何使用where过滤器获取元数据?我有一大堆页面,所以循环使用它们效率非常低…

问题是
表达式在给定特定条件下返回数组中的所有对象

[#<Jekyll::Document _chapters/chapter3/section1 collection=chapters>] 

完美的现在我只需要回去重构所有这些for循环!
  {% assign ch3s1 = site.chapters |
  where:"id","/chapters/chapter3/section1" | first%} 

  title: {{ch3s1.title}} 
  <br>
  url: {{ch3s1.url}}
  title: Chapter 3 section 1
  url: /chapters/chapter3/section1