【发布时间】:2021-04-22 13:44:48
【问题描述】:
我有一个自定义变量,我将它传递到我的包含文件中,奇怪的是它被视为文件名。我不确定我做错了什么:
我的组件包含:
{% include_relative includes/form/components/modal.html for="purpose" %}
而includes/form/components/modal.html的内容是:
<div class="modal-custom modal-custom-white" data-modal-custom="{% include.for %}" data-modal-requires-update-button>
<div class="modal-custom-background bg-white"></div>
<div class="modal-custom-content p-3">
{% if include.title %}
<h5 class="font-weight-normal text-dark mb-3">{% include.title %}</h5>
{% else %}
<h5 class="font-weight-normal text-dark mb-3"><strong>Tap</strong> to choose:</h5>
{% endif %}
<!-- Modal content here -->
{% if include.content %}
{% include.content %}
{% endif %}
</div>
<button type="button" class="modal-custom-close is-large bg-light" onclick="toggleModal('purpose', 'close-retain');diposeExpandedToggler('purpose', true)"></button>
</div>
我正在运行最新版本的 Jekyll,版本 4.2.0,如果我删除 for,那么一切正常。我试过了:
- 重命名变量
- 清理缓存
- 以不同的方式格式化变量,例如:
for=purpose和for="purpose"
我在另一个组件中创建了类似的东西,在那里一切正常,但我在这里遇到的错误是:
液体异常:在任何 ["/Users/USER/Sites/MY-PROJECT/src/_includes"] 中都找不到包含的文件 '.for'。确保它存在于这些目录之一中,如果它是符号链接,则不要指向您的站点源之外。在 icicle.html 中
这很奇怪。我错过了什么?
【问题讨论】: