# Problem with programmable-blueprints cookbook

**URL:** <https://forum.getkirby.com/t/problem-with-programmable-blueprints-cookbook/24463>\
**Category:** Questions\
**Tags:** v3\
**Created:** [January 13, 2022, 12:19am UTC](https://forum.getkirby.com/t/problem-with-programmable-blueprints-cookbook/24463 "2022-01-13T00:19:02Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![jaro.io](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jaro.io/32/11374_2.png) [@jaro.io](https://forum.getkirby.com/u/jaro.io)\
**Post date:** [January 13, 2022, 9:11am UTC](https://forum.getkirby.com/t/problem-with-programmable-blueprints-cookbook/24463/7 "2022-01-13T09:11:51Z")

</div>

**yup, here you go!**

`index.php`

* * *

```auto
<?php

use Kirby\Cms\App as Kirby;

Kirby::plugin('cookbook/dynamic-blueprints', [
    'blueprints' => [
        'pages/meals' => function ($kirby) {
            return include __DIR__. '/blueprints/pages/meals.php';
        },
    ]
]);

```

`meals.php`

* * *

```auto
<?php

$sections = [];

if ($page = page('meals')) {

    // create dynaimic sections
    foreach ($page->site()->find('categories')->children() as $category) {

        $sections[explode('/', $category)[1]] = [
            'headline' => $category->title()->value(),
            'type' => 'pagesdisplay',
            'status' => 'published',
            'layout' => 'cardlets',
            'empty' => 'No products yet',
            'query' => "page.children.filterBy('type', '==', '" . $category . "')",
            'templates' => 'meal',
            'image' => false,
            'info' => '{{ page.descr }}'
        ];
    }

    // add drafts
    $sections['drafts'] = [
        'headline' => 'Drafts',
        'type' => 'pages',
        'status' => 'draft',
        'empty' => 'No products yet',
        'templates' => 'meal',
        'image' => false,
        'info' => '{{ page.descr }}'
    ];
}

// create the array for the page blueprint with two columns
$yaml = [
    'title' => 'Meals',

    'image' => [
        'back' => 'white',
        'icon' => 'food',
        'color' => 'black'
    ],

    'options' => [
        'changeSlug' => false,
        'changeStatus' => false,
        'changeTemplate' => false,
        'changeTitle' => false,
        'delete' => false,
        'preview' => false,
        'update' => false,
        'duplicate' => false
    ],

    'sections' => $sections
];

return $yaml;

```

✨

---

_[View the full topic](https://forum.getkirby.com/t/problem-with-programmable-blueprints-cookbook/24463)._
