当前文件的jekyll文件名

时间:2017-01-01 05:59:04

标签: ruby jekyll liquid

标题说明了一切。有没有办法在Jekyll中访问当前文件名?在你跳枪并尝试将其标记为重复之前,请记住我要求当前文件名,而不是生成的文件路径,可以通过page.url访问。

举个例子,假设有一个包含file2.html的file1.html。我希望能够获得file1.html如果我在file1.html和file2.html中反之亦然。 page.path只返回生成文件的文件名,因为我将从file2.html中获取file1.html。

一个具体的例子:

file2.html:

CMake Error at CMakeLists.txt:162 (include):
  include could not find load file:

    ThriftMacros

CMake Error at CMakeLists.txt:164 (ADD_LIBRARY_THRIFT):
  Unknown CMake command "ADD_LIBRARY_THRIFT".

的file1.html:

<div>
{{ page.name }}
</div>

的index.html:

<div>
{% include file2.html %}
</div>

渲染:

{% include file1.html %}

我希望它返回file2.html

而不是index.html

由于

1 个答案:

答案 0 :(得分:0)

编辑:包只是插入页面的片段。完成每个包含后,页面将作为单个代码块处理。

无法从包含name.b

的液体中获取任何信息
相关问题