Using query language to display page title (from page object)

Hello. I’m setting up a pages section. Instead of using the default text to display the page titles I’d like to display a value from a location field. The hitch is that the location field is a select field and it queries a parent page to populate its values. If I just use the following it pulls the path to the page.

text: "{{ page.my_location }}"

I’d have to get the page object and then get the page title. Something like…

text: {{ page.my_location.toPage.title }}

But that doesn’t work.

Any insight?

Could you post the blueprint settings for your my_location select field? Because your second example should actually work, at lease once you add the missing quotes…

Sure. See below please.

  label: Location 
  type: select 
  options: query
  query: site.find('/summer-camps/locations').children

Ok, that should actually store the id of the page in your content, so this should work:

text: "{{ page.camp_loc.toPage(',').title }}"

We need the comma here, because the field doesn’t store yaml… Saw that too late.

Hmm. It does indeed work, but not with all of my pages.


It works for the one who’s page title is TBD

Could you show me what is stored in one of the pages that don’t work vs the one that does work?

Pulling the title from the following works.

Title: TBD





Pulling the title from the following does not work.

Title: Stow Community Park


Address: 50 Bolton Road


City: Stow


State: MA


Zip: 01775









I’m looking into this further on my end.

I understand what happened now.

After I created a few location entries I decided to move them into their own ‘locations’ folder. That rendered the path stored in the location field incorrect. So my query in the pages section’s text option failed because it couldn’t find the page to turn it into an object. There’s no error message, but that’s what must have happened.

That’s what I suspected, therefore I wanted to know what is stored in the select field, not in the location pages themselves.

The query language doesn’t throw an error in such cases.

Understood. Thanks @texnixe

You are very welcome and thanks a lot to you, very appreciated! :heart_eyes: