Kirby Modules Plugin (Kirby 2)

With Kirby Modules you can make the content of your Kirby site modular. It allows users to create custom editorial pages that are composed of multiple content modules such as body text, galleries, pull quotes or maps.

What is a module?

A module in the context of this plugin is:

  1. A blueprint and a PHP snippet together with other optional files and assets that define the module’s code.
  2. A subpage in the content directory that uses the module’s blueprint.

One content page can have multiple module subpages of different types and module subpages can contain images or other files depending on the module type. These module subpages can be reordered in the Panel like other pages. The order in the Panel defines the order on the page. They can also be set to “invisible”, which hides them on the page as well, so they can be used as drafts within a page.

You can find a demo of how such a module looks like on the demo branch.

Download and further information:

You can of course install the plugin with the Kirby CLI:

kirby plugin:install modules-plugin

Thank you to @sashtown for the inspiration.
We are looking forward to your feedback!


Cool Idea Lukas :slight_smile:, is that your First Plugin For Kirby?

Thank you!

Developing plugins for Kirby is my job, so no. :smiley:
It is my second public one after the Algolia plugin though. :slight_smile:

1 Like

Wow, wow, wow, wow…
Speechless for now.
Testing asap !

Rockstars @lukasbestle and @sashtown !!

1 Like

Good Work Lukas :blush:

1 Like

Thanks Lukas! This seems to fix one of my biggest gripes about the way Kirby stores its templates and blueprints by default. That is, separated by “type” and not grouped by page/context. Now all that’s missing is a way to also save page templates along with their controllers and models (and maybe page-specific snippets) so it’s easy to see all page-related files in one place. Which is coincidentally exactly what I love so much about the way kirby stores page content, but is sadly missing from the site folders’s structure.

Will definitely use this in my next project.

Please note that modules can’t have controllers and models. :slight_smile:
Other than that, thank you!

Yup, I was aware of that.

I was just daydreaming about how the existing page-related source files (templates, controllers, models) could also benefit from being grouped in single per-page folders, similar to how your Kirby Module files are grouped. :wink:

With the new registry, something like that is definitely possible. :slight_smile:

Nice, I have created for this every time a unvisible content with extra checkbox.

Great!, this works very similar to my Solution discussed here Add Explicit Support for Multi-Section Pages. With the difference that this is notably more ordered and its integration with “kirby patterns” is great.

However, I think that the use of Controllers and Models are essentials for the Modules, It would be great if you add the support for that.

Thank you for the feedback.

What would be your use-case for controllers and models? Since the modules are constrained to be displayed on one page only, I can’t think of one for models. Controllers might be useful though.

  1. Can you give some use cases for this plugin? When can it be useful?
  2. Are the modules like patterns user controlled in the panel?
  1. We are using it for a project where each page is pretty much unique. The layout of all pages is different. That’s where this makes most sense, because then we don’t have to create hundreds of templates but just a few modules that can be configured and rearranged however the client likes.
    The plugin can also be used for simpler use-cases like a one-pager. The advantage is the same: The client can rearrange the content modules.
  2. Kind of, yes. That’s why it is so useful to combine the Modules plugin with the Patterns plugin.
1 Like

Modules Plugin v1.1.0

I just published a new version of the Modules plugin featuring some new helper methods.


7 posts were split to a new topic: Modules plugin: CSS file for each module

Modules Plugin v1.2.0

The Modules plugin now has its own Kirby extension registry for modules, which allows you to register modules from other plugins. Thanks to @dweidner for the idea.



i have a problem… again :stuck_out_tongue:

i defined a image field in a module like:

    label: Background image
    type: image
    icon: image

and try to get the URL to the image in my module html.php with:

<?= $module->bgimage()->url() ?>

but i just get something like:


http://localhost/localtest/kirbymodule/ is the root of my page and fullscreen-bg5.jpg is the image for the module. But the url is not correct for the image.

have i overlooked something?

best regards,


<?= $module->bgimage()->toFile()->url() ?>

gives me:

Fatal error: Call to a member function url() on a non-object in…


BUT <?= $module->bgimage()->toFile() ?> gives me the a tag and i see the image:

<img src="http://localhost/localtest/kirbymodule/content/2-projects/1-project-a/3-static-wall/fullscreen-bg5.jpg" alt="">

hmm…anyway. i need just the URL for CSS-trickery.