It’s weird. site.find('my-page') does not work with or without the additional .services.toStructure. doesn’t matter what of my pages i put in there. site.children.template('my-template') gives me the pages i want to fetch. But when I add .services.toStructure like this:
You want to fetch a field, so you need a single page, but site.children.template('whatever') gives you a (filtered) collection (even if only one page with that template exists). And you just can’t call a field on a collection.
Is your subfield in the structure really called platform?
This here refers to a field that is present in your structure item, in this case platform but you have to change this depending on your field names.
I am having a similar problem and have tried to simplify the blueprint as much as possible but am still having issues. I have a series of pages that use the research-nugget blueprint. For testing, I have put the structure field in the same blueprint as the one I want to query. It queries that structure field on sibling pages. Here is part of my research-nugget.yml blueprint:
In the code above, if I query the the sibling page itself (the part that is commented out) it works fine. But when I try to query the structure field, this is the error I get:
The problem in this thread is that people tried to fetch the field from a collection, which is just not possible, because it is wrong syntax (ie. that code wouldn’t work in a template either).
What you would have to do (if that’s what you want to do), is create a single structure object from these pages and then use that in the query.
I want to do similar thing, but display structure field as structure field. The goal is to show options for product, so that client could add new fields himself from panel.
Or in other words, the goal is to repeat structure field on other pages, so that there is pre-populated structure field on every product blueprint page.
The only way to achieve this would be via programmable blueprints, as @bnomei just added. This only works if the fields are defined in a fixed page or in the site.