将子文件夹添加到Jekyll中的_includes目录中

时间:2018-10-20 19:25:13

标签: jekyll

我正在尝试在Jekyll的“ _includes”目录中添加文件夹。没用我已经尝试在文件夹中添加下划线,但是它也不起作用。我究竟做错了什么?我正在使用Jekyll 3.7.0

我找到的最有用的链接是this one

以下是一些屏幕截图:

enter image description here enter image description here

堆栈跟踪为:

 Incremental build: disabled. Enable with --incremental
  Generating...
    Pagination: Pagination is enabled, but I couldn't find an index.html page to use as the pagination template. Skipping pagination.

Liquid Exception: Could not locate the included file 'sidebar.html' in any of [".../_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in /_layouts/page.html
jekyll 3.7.0 | Error:  Could not locate the included file 'sidebar.html' in any of [".../_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source.

我认为我应该能够使用子目录。我究竟做错了什么?预先谢谢你!

1 个答案:

答案 0 :(得分:0)

显然,我发现了问题。我不知道为什么,但是Jekyll可以解析评论。它检测到我已经注释了一段引用旧的sidebar.html的代码。

正如@DavidJaquel在下面的评论中提到的那样,HTML注释<!-- -->并没有阻止Liquid来解析我们的页面内容,因此我们应该使用Liquid语法:

{% comment %}
   ...
{% endcomment %}

enter image description here