3

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".

rocco
  • 115
  • 1
  • 7

1 Answers1

2

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

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

More info:

Matias Kinnunen
  • 7,828
  • 3
  • 35
  • 46
  • @rocco Great! Please see [_What should I do when someone answers my question?_](https://stackoverflow.com/help/someone-answers) – Matias Kinnunen Sep 04 '21 at 16:35
  • I see. I have now accepted your answer. I wanted also to vote it, but it says "You need at least 15 reputation to cast a vote," – rocco Sep 05 '21 at 10:57