# Creating module with subpage builder

**URL:** <https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425>\
**Category:** Questions\
**Tags:** v2\
**Created:** [May 16, 2018, 4:38pm UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425 "2018-05-16T16:38:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lonelyalien](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lonelyalien](https://forum.getkirby.com/u/lonelyalien)\
**Post date:** [May 16, 2018, 4:38pm UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/1 "2018-05-16T16:38:20Z")

</div>

I’ve been having an issue with using subpage builder to build a specific module. Imagine I have a module called ‘test’, with the module template ‘module.test’. To create a new module using Subpage Builder, I would do this:

```auto
build:
        - title: Test
        uid: modules/test
        template: module.test

```

This works, however, you end up with a nasty error and not allowing you to continue. If you reload the page, the page and the module are created nonetheless.

 ![04](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/c/c450b766763562010d403702acfdb267a98ae2a5.png)

I’ve been using [Modules Builder](https://github.com/medienbaecker/kirby-modules-builder) to take care of building the Modules for specific modules. It probably has something to do with the fact that maybe the route it addresses gets executed after Kirby tries building the subpage? Anyone with experience building this?

---

<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:** [May 16, 2018, 5:22pm UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/2 "2018-05-16T17:22:01Z")

</div>

> [@lonelyalien](#):
>
> uid: modules/test

I. think the problem here is that you add a path where you should just have a UID

---

<div class="post-metadata">

**Author:** ![lonelyalien](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lonelyalien](https://forum.getkirby.com/u/lonelyalien)\
**Post date:** [May 17, 2018, 7:00am UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/3 "2018-05-17T07:00:06Z")

</div>

The reason why it’s there is because otherwise the module subpage would be placed in the root of the page folder, not the ‘modules’ folder.

I’ve been trying to operate it through a hook, but haven’t had any luck with that one yet.

---

<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:** [May 17, 2018, 7:09am UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/4 "2018-05-17T07:09:45Z")

</div>

Well, it is not indended to work like that. You would need one blueprint that creates the modules folder (the page blueprint), and then for the module subpage a blueprint that creates the submodule pages.

So this:

```auto
build:
        - title: Test
        uid: test
        template: module.test

```

would go into modules.yml

---

<div class="post-metadata">

**Author:** ![lonelyalien](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lonelyalien](https://forum.getkirby.com/u/lonelyalien)\
**Post date:** [May 17, 2018, 7:12am UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/5 "2018-05-17T07:12:34Z")

</div>

It kinda works because there’s a hook creating the modules subfolder, before (?) the subpage builder gets initiated. It’s only the panel that’s not up to speed of what’s happening in the background (hence the error).

Having to put it ‘the right way’ would mean the modularity of the modules concept goes lost. I could just put in a few modules in any blueprint and let the panel create them in the background.

---

<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:** [May 17, 2018, 7:21am UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/6 "2018-05-17T07:21:42Z")

</div>

I’m just telling you how it is supposed to work.

I see your point. What you can do:

- for each type of page that needs different modules, give those modules subpages another blueprint. Then in that modules\_type1.yml define what modules should be created.
- put the modules directly into the page folder without the modules subpage
- try to modify the Panel source code

---

<div class="post-metadata">

**Author:** ![lonelyalien](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@lonelyalien](https://forum.getkirby.com/u/lonelyalien)\
**Post date:** [May 17, 2018, 7:25am UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/7 "2018-05-17T07:25:21Z")

</div>

I get that! I’m happy that it works in most cases. Because most modules in this project are either interfaces for functions or snippets, I’ll solve it in another way.

Thanks for thinking with me tho.

---

<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:** [May 17, 2018, 7:29am UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/8 "2018-05-17T07:29:15Z")

</div>

Oh, yeah, and I forgot the hooks, of course. But you said that didn’t work out for you?

---

<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:28pm UTC](https://forum.getkirby.com/t/creating-module-with-subpage-builder/10425/9 "2025-02-06T17:28:14Z")

</div>


