如何循环遍历 Jekyll 中 _data 文件夹中的每个文件?
目前,我在名为 sidebarlist.yml 的文件中有一个文件列表,如下所示:
- file1
- file2
- file3
Run Code Online (Sandbox Code Playgroud)
为了循环遍历所有这些文件,我使用以下代码:
{% for sidebar in site.data.sidebarlist %}
{% for entry in site.data.sidebars[sidebar].entries %}
...
{% endfor %}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)
我想避免使用 sidebarlist.yml 并自动迭代 _data 中的所有文件。我可以这样做吗?
我有一个名为default.html
我的layouts
文件夹中。在中default.html
,我想添加一个相include
对于的相对对象test.html
,它也在我的layouts文件夹中。
我{% include_relative test.html }%
在default.html
文件中添加include test.html
。但是,当我这样做时,我得到一个错误,指出
"Liquid Exception: Included file './test.html' not found in
projects/[projectnmae]/layouts/default.html"
Run Code Online (Sandbox Code Playgroud)
我的layouts
文件夹确实位于配置文件中指定的其他位置。有什么想法include_relative
可以以一种我不掌握的特殊方式起作用吗?
我正在尝试编写一个脚本,从命令行启动 Jekyll,执行另一个进程,然后停止它。
逻辑是这样的:
我对命令行不是很有经验。我想我必须使用--detach
Jekyll的命令在预览服务器构建后继续运行脚本。但是如果我分离 Jekyll,停止服务器的唯一方法是杀死特定的 PID,但 PID 编号似乎是随机生成的。
任何人都有关于如何构建这个脚本的任何提示?