Working with modules

Hi guys,

I’m currently trying my first steps with Kirby to get rid of this monster that is Wordpress. :slight_smile:
For my first project, I want to rebuild this website in Kirby: http://www.robinbrezina.com/

But (plot twist):
I would like the sections on the home page to be modules, of which the texts can be edited in the panel (= by my client, not by me).

In my imagination it looks like this: in the home.php I just want to say “paste countdown here” and in the panel, there’s a page (or something similar) called ‘countdown’ which has the content in it.
I haven’t found a ‘native’ way to do it, yet. I did find a plugin (https://github.com/frekw/kirby-modules) but before I start installing stuff, I would like to know if there’s a simpler solution. Is there any?

To be clear: it’s not the same as the one-pager in the docs (https://getkirby.com/docs/solutions/one-pager) because I don’t want the modules to appear in the menu.

Cheers,
Dennis

Whether or not the modules appear in the menu or not, is not the important factor here, you can build your menu independent of that.

Generally, you have several options:

  1. Use subpages for each module of each one page as described in the docs.
  2. Use @timoetting’s page-builder field.
  3. Maybe the modules plugin you mention, although I have no experience with it.
1 Like

Hey,

What do you mean by point 1? Because if I create pages for each module, they will appear in the menu, right? And if I make them invisible, they disappear all the way (not only in the menu, but also on the website).

Cheers

That depends in your menu. Let’s say you have several main pages which are visible. All these main pages can contain subpages which work as the modules of each of these main pages. Then these subpages can be either visible or invisible, it does not matter. It’s just a flag and does not mean the content can not be displayed on a page. An invisible page can be accessed via its URL just the same as a visible page. And you decide what you include in the menu, there is nothing automatic.

The starterkit menu is just an example, that you can adapt to your purposes.

1 Like

Ah, I think I get it. :slight_smile: Still have to experiment a lot, but thank you for your input. I might get back when more questions arise.

Yeah, sure. It’s probably hard to understand at the beginning, but we are here to help.

What you could do is to make the module pages children of the home page directly in content/home. They are then clearly defined as being modules for the homepage and also it becomes easier to exclude them in the menu.

Sounds very good actually, I thought about that too. The problem is that I cannot create subpages in “home” for some reason from the panel. I probably could create folders and files manually, I guess, but that’s dirty.

Do you know how to handle it?

I tried @texnixe 's way yesterday and just excluded certain pages from the menu. Still not an ideal solution, I think, but at least it works now. :slight_smile:

You can create a home.php blueprint that allows subpages.

If you post your structure and the pages you want in the navigation, we can help you come up with a good solution. Do you want the same structure as the site you referenced above?

Sure :slight_smile: Basically I want the same structure as in the page I referenced, yes.
Very good hint about enabling pages in the blueprints. Will try that out right now!

So you have:

  • Home
    – Hero/Intro/Countdown
    – About (not in the current page)
    – Season 2016
    – Partners

  • Career

  • Gallery

  • Contact

Thanks a lot already, people. Good to find such a caring and helpful community. :slightly_smiling_face:

Ok, in your example, make Home invisible and Career, Gallery and Contact visible, the you can do your navigation like this:

<nav>
  <ul>
    <?php foreach($pages->visible() as $p): ?>
      <li ><a <?php e($p->isOpen(), ' class="active"') ?> href=""><?= $p->url() ?></a></li>
   <?php endforeach ?>
  </ul>
</nav>

If you want the home page to appear in the navigation, make it visible as well.

It makes sense to make the subpages of home visible, to sort them in the right order.

1 Like

Makes totally sense. Thank you :slight_smile: