Work with several file.yml version?


Is there a way in the index.php file to indicate which Yaml file to use under certain conditions ?

For instance:

if ( condition A ) {
    // use site-A.yml
} elseif ( condition B ) {
    // use site-B.yml

Thanks for your advices

What are your conditions?

Thanks for this link.
I set a key/value in the site.txt file and under this value, I would like to use different site.yml file

I tried this in a plugin but it did not work:

if ( true ) {
    $dir = __DIR__ . '/blueprints/site/site.yml';
} else {
    $dir = __DIR__ . '/blueprints/site.yml';

Kirby::plugin('gillesvauvarin/plan-blueprints', [
    'blueprints' => [
        'site' => $dir

The default site.yml file is steel called by Kirby

Maybe this part is not correct:

'blueprints' => [
        'site' => $dir

No so sure it works like that if the value is actually set in the site.txt file, but haven’t tested myself yet.

@texnixe I did some tests with other blueprint files (other than site.yml/site.txt) without success. So I did a test with Plainkit and it does not work either.

This is the code of my test with Plainkit:


if(true) {
    $dir = __DIR__ . '/blueprints/pages/test/default.yml';
} else {
    $dir = __DIR__ . '/blueprints/pages/default.yml';

Kirby::plugin('cookbook/role-blueprints', [
    'blueprints' => [
        'pages/default' => $dir

blueprints/pages/test/default.yml (I just add a TEST word in the text label)

title: Default Page
preset: page
    label: Text TEST
    type: textarea
    size: large

Did I miss something ?
If you need my plainkit test, I can send you a zip file.