Html Jekyll中的分类页面

Html Jekyll中的分类页面,html,jekyll,liquid,Html,Jekyll,Liquid,我有一个category.html页面,可以循环浏览特定类别的帖子 {% for post in site.categories.tech %} 当用户单击时,我要显示的是index.html页面 {{ post.categories }} 这是从显示所有帖子的循环中生成的 {% for post in site.posts %} 我需要{{post.categories}变量来替换categories.html中的.tech,如下所示 {% for category in site.ca

我有一个
category.html
页面,可以循环浏览特定类别的帖子

{% for post in site.categories.tech %}
当用户单击时,我要显示的是
index.html
页面

{{ post.categories }}
这是从显示所有帖子的循环中生成的

{% for post in site.posts %}
我需要
{{post.categories}
变量来替换
categories.html
中的
.tech
,如下所示

{% for category in site.categories.{{ post.categories }} %}

我不知道如何将变量从
index.html
传递到
categories.html
站点类别是一个对象,其中每个键都是类别名称。所以

{{ site.categories }}
输出如下所示:

{
  "Category name" => [#, #, #, #, #, #, #],
  "Another category name" => [#, #, #, #, #, #, #],
  ...
}
因此,方括号应该可以做到这一点。因此,如果在index.html的前面有

---
categories: tech
---
下面的代码将把你所有的帖子都归入技术类

{% for post in site.categories[post.categories] %}
  {{ post }}
{% endfor %}

当然,如果前面有多个类别,这将不起作用,但我不知道您的用例。

如何传递从index.html单击的变量。如果用户单击了tech,我如何将其传递到categories.html并将值放入[post.categories]中?我不理解“单击变量”的含义。请举例说明如何在
index.html
post.categories中定义该变量。类别将传递到下一页。