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 %}
希望你們能幫助我。
提前