# Blueprint : build vs false

**URL:** <https://forum.getkirby.com/t/blueprint-build-vs-false/14465>\
**Category:** Questions\
**Tags:** v2\
**Created:** [June 1, 2019, 6:59pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465 "2019-06-01T18:59:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [June 1, 2019, 6:59pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465/1 "2019-06-01T18:59:55Z")

</div>

Hi there

I’m having a conflit between “build” and “false” option from pages blueprint. I would like to build automatically a subpage when a page is created + hide this subpage and don’t hollow user to add or modifiy subpages. This is my blueprint, the subpage is created and I see the “Add” / “Modify” pages from the left.

```auto
    pages: false
      build:
        - title: api
          uid: api
          template: projectapi
          num: 1

```

I’m still running on 2.5.12, do you think this can be solved ?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 1, 2019, 7:30pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465/2 "2019-06-01T19:30:22Z")

</div>

Instead of using the page builder function in the blueprint, you can create those subpages with a hook, similar to what I describe in [this K3 recipe](https://getkirby.com/docs/cookbook/extensions/subpage-builder), only adapted to Kirby 2 code/syntax.

---

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [June 1, 2019, 8:03pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465/3 "2019-06-01T20:03:32Z")

</div>

Thanks, with your help, I’m close.

```
try {
    $newPage = $page->children()->create('api', 'projectapi', array(
        'title' => 'My API',
    ));
    echo 'The new page has been created';

} catch(Exception $e) {

    echo $e->getMessage();

}

```

The weird thing is I get a **An unexpected error occurred** when I click on “Add” (Adding subpage modal) but my subpage is created… I have removed the builder option and keep `pages: false`.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 1, 2019, 8:07pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465/4 "2019-06-01T20:07:30Z")

</div>

Hm, if you set `pages: false` there shouldn’t be an `Add` button anymore?

---

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [June 1, 2019, 8:14pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465/5 "2019-06-01T20:14:20Z")

</div>

No, I’ve set `pages:false` to the subpage blueprint, to be sure the user don’t add more subpage(children children) to the subpage (children). But on the pages blueprint (parent), I have set

```
pages:
  template: project
```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 1, 2019, 8:19pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465/6 "2019-06-01T20:19:17Z")

</div>

Don’t know what’s in your hook, but in any case you should limit that to page with a given template. Otherwise, whenever you create any page, those subpages would be created.

---

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [June 1, 2019, 8:40pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465/7 "2019-06-01T20:40:49Z")

</div>

Well thank you very much, it was simple as

```
kirby()->hook('panel.page.create', function($page) {
   $page->children()->create('api', 'projectapi', array(
        'title' => 'API',
    ));
});
```

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:23pm UTC](https://forum.getkirby.com/t/blueprint-build-vs-false/14465/8 "2025-02-06T17:23:16Z")

</div>

Archived on February 6, 2025, 5:23pm UTC


