Search code examples
liquidnunjuckseleventy

change liquid syntax into nunjucks - is this correct?


I need to change this liquid syntax into nunjucks:

{% assign posts = collections.post | getPostsByContributor: contributor.key %}

Is this correct for nunjucks?

{% set posts = collections.post | getPostsByContributor: contributor.key %}

Eleventy gives me error "expected block end in set statement".


Solution

  • The syntax for passing arguments to Nunjucks filters is a bit different. Try this:

    {% set posts = collections.post | getPostsByContributor(contributor.key) %}
    

    More info: