包含非英语 (UTF-8) 文件名文件时 Liquid 模板出错

Error in Liquid templating when including non-english (UTF-8) filenamed files

我有一个非英语语言的 html 文件 ( മലയാളം.html )。如果我尝试使用下面的代码包含这个 html 文件,我会收到下面显示的错误。

{% include blog_comments/മലയാളം.html %}

顺便说一句,我正在使用 Jekyll。但我相信错误来自 Liquid

Regenerating: 1 file(s) changed at 2016-05-05 09:49:14 Liquid Exception: Invalid syntax for include tag. File contains invalid characters or sequences: blog_comments/മലയാളം.html Valid syntax: {% include file.ext param='value' param2='value' %} in _includes/post_comments.html, included in _layouts/post.html

有谁知道如何获取文件 മലയാളം.html?

如果你阅读 jekyll/tags/include.rb code,你会看到文件名是根据正则表达式验证的,主要部分是:

/^[a-zA-Z0-9_\/\.-]+$/

这意味着 包括名称 不能包含除欧洲字母(小写或大写)、数字或 /、_、- 和 .

以外的其他内容

您必须将其重命名为 blog_comments/Malayalam.html ;-)

注意:您的页面或 collection 项(包括帖子)的名称可以包含 മലയാളം