Querying information to display

Hi,

I would like to display the project’s place title inside the info, like “Paris” for exemple, using the page.place value (eg: “paris”) to find the corresponding page and get its title().
I have all my places pages stored in a places folder.
Here is the actual fields section of my home.yml blueprint code, all works find except the info part:

fields:
  featured:
    label: Featured projects
    type: pages
    options: query
    query: site.find('projects').children.listed
    layout: cards
    info: "{{ site.find('places').children.findBy('uid', page.place).title }}"

My content folder structure looks like this:

37

I guess that the problem comes from the findBy() part, but I can’t find the solution.
What am I doing wrong? :thinking:

Using a variable inside the findBy() method currently doesn’t work (we will have more options in the upcoming 3.2version).

You can, however, overcome this limitation by creating a page model and use that in your query.

info: "{{ page.location }}"

Then create a model with a location method that returns the location.

1 Like

Thank you very much for you quick answer!
Indeed, it works perfectly using page model :+1:

Looking forwards to see the upcoming 3.2 options :wink: