0
我有一个_includes
文件夹,其中我有nav
子文件夹包含一个nav.html
文件。使用Jekyll如何检查文件夹中是否存在文件?
我一直在试图检查nav
中是否存在nav.html
。如果是这样,我想包含该文件。如果它不存在,我的模板将会有一个默认的nav
。
这是我现在所拥有的代码:
{% for static_file in site.static_files %}
{% if static_file.path == '/nav.html' %}
{% include nav.html %}
{% endif %}
{% endfor %}
希望你们能帮助我。
提前