String templates aka query language are not supported for most default values. What you could do is create your own number field in plugin:
PHP:
Kirby::plugin('my/plugin', [
'siteMethods' => [
'getSeason' => function () {
return 5;
},
],
'fields' => [
'num' => [
'extends' => 'number',
'props' => [
'default' => function ($default = null) {
return $this->toNumber($this->model->toSafeString($default) ?? '');
},
]
]
]
]);
JS: index.js
panel.plugin("my/plugin", {
fields: {
num: {
extends: "k-number-field"
}
}
});
Yaml:
fields:
season:
type: num
default: "{{ site.getSeason }}"
The above refers to Kirby 3 + 4, just noticed that according to the category you have chosen you still seem to be on Kirby 2, is that correct?
For Kirby 2, I can’t remember, it’s no longer supported.