我需要将这种液态语法更改为双关:
{% assign posts = collections.post | getPostsByContributor: contributor.key %}
这对双节棍正确吗?
{% set posts = collections.post | getPostsByContributor: contributor.key %}
Eleventy给出了错误& &;expected block end in set statement& &;
将参数传递给Nunjucks过滤器的语法略有不同。试试这个:
{% set posts = collections.post | getPostsByContributor(contributor.key) %}
更多信息:
- 液体过滤器文档
- Docs for Nunjucks filters