magnolia

Magnolia Headless Delivery API and personalized pages with filter query


We are using the personalization module to setup page variants (page-level) using a headless approach (JS Frontend). Reading the docs, I understood that there is either a Query nodes or Get children scenario. It looks like that page variants are only handled when not using the Query nodes case. Unfortunately, I can not order nor filter the results in that case.

Is there any chance to use filter and orderBy params but also returning page variants based on my request traits? How would such a request look like?


Solution

  • For performance reasons, the variants filtering on queries is not supported. Hence, short of writing your own EP, there is no solution.

    As alternative/workaround, you can perhaps run query and then on the path of each result make a call to retrieve a variant of that result via individual node retrieval EP, but that's also slow and waste of bandwidth ... perhaps getting list of nodes you want via GQL EP and then getting variant for each is tiny bit better (but not much).