Default related Page with query from field of site.yml

Hey. We built a native color selector. Means. We have in the root / site in the content folder a folder “colors” (template / blueprint) and there are subpages (template / blueprint) with a text field for the HEX value of the color. In the blueprint we use the new feature from version 3.6 “back:”{{ page.color }}" to display the color.

This works really well. But now I would like to set a default color which I have set in the Site.yml as textcolor. But it seems that the value is read but not interpreted - or if I integrate this query into the help for testing, an LI element is always set and not the value alone.

Here is the blueprint for the block and the color selector with pages :


color:
type: pages
max: 1
label: color
default: “{{ site.textcolor }}”
subpages: false
multiple: false
link: false
width: 1/3
query: site.find(“colors”)
empty: 'Choose Text Color

So is this impossible or is just my syntax for the query of default: not correct?

I think blueprint language for default values in general doesn’t work.

Thanks Sonja. :slight_smile:

I think what should work is to create the blueprint programmatically, then set the default value via PHP:

Alternatively, you could use a page.create:after hook to populate the field after creation. Or a model that overwrites the create method.