不接受液体动态文件名 [英] Liquid dynamic filename is not accepted

查看:87
本文介绍了不接受液体动态文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用

{% include folder1/folder1_1/img.jpg %}

它完美地工作,但是当我尝试动态生成文件名时,我们说:

it works perfectly, But when i try to generate the filename dynamically let's say :

{%capture filename %} {{'folder1/folder1_1/'}}{{ images[0] }}{{ '.jpg' }}{% endcapture %}

{% include {{ filename }}  %} 

例如,以

,我得到的错误是:

with images[0] = 'img' for example, i get the error that says :

Liquid Exception: Invalid syntax for include tag. File contains 
invalid characters or sequences ...

我不明白为什么通过提供完整路径(静态路径)来包含文件有效,而动态生成文件名却行不通!

I Don't understand why including file by providing the complete path(static path) works whereas generating the filename dynamically won't work !

任何帮助将不胜感激.

推荐答案

在Internet上进行了更多研究之后,由于不能在目录中计算并添加包含的文件,因此似乎无法添加动态文件名路径. >编译阶段,而不是在运行时阶段.

After more research on the internet it seems that dynamic filename paths can't be added due to the fact that the included files are calculated and added at the compilation phase and not at run time phase.

编译阶段意味着动态路径尚未被识别.

And compilation phase means dynamic paths aren't yet recognized.

这篇关于不接受液体动态文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆