How to get rid of "homePage"?

My site does not have a homepage. Currently Kirby requires me to set a homepage (default ‘home’ if nothing else has been set). As i don’t have a page with a home slug, there is an Exception that the Homepage is not found.

What can i do to learn kirby to not require one particular page to be something like a homepage?

What I want to achieve is that as long as no page has been called, an overview page with a main navigation is displayed. On the overview page all listed pages should be displayed equally. None of these pages is the homepage. Within these pages you can navigate back and forth only via a breadcrumb navigation. On the top level all listed pages should be displayed equally.

At present there are unfortunately only problems with it, because Kirby hard-coded always requires a homepage.

I’m not sure I understand it correctly, but why can’t you set your “page which should be called if no other page is called” as your homepage?

Because there is no other page.

The listed-Pages all are subpages for the site planned. None of them can be called as a homepage.

If no particular page is called, there only should be a page with a main navigation listing all the listed-pages of the site.

I hope that makes it clear.

Despite of that the site is empty on default, that means that there is no page with the home-Slug, what results in an exception. As soon as the first page has been created, there is a page but this page does not necessarily have to be called “home”, it can have any URL. But you don’t know that URL before (to configure it as home in config.php.
Additionally the order of the pages can change, so you can’t declare any of the listed pages as “home”. They are all equally, not home.

Imagine something like a knowledge base:

Each page you set up should be a category under which knowledge articles can be published.

So you want to display a list of all categories (pages) on your start page.

And that’s where the problems start, because Kirby expects one of the pages to be called home. But home does not exist as a category or page. And now?

Well, you need a start page, no matter what you call it. You could set home to the first page in the list of pages or something like that. But in any case, at least one page needs to exist.

As soon as one page is created by the later user, there is a page - of course.

But it doesn’t need to be called home. Thats why there is still an exception :frowning:

What i managed to do so far is when instantiating the Kirby App i set the home configuration setting automatically to the first listed page (the directory name of 1_xxxx in the content folder). I consider this to be a dirty hack.

The problem with that is, that kirby removes the path from the URL. So when you try to use page.url in the template, it breaks.

It is really not mandatory that any page be named home.

At first glance, it may seem that you always have to have a page called home. But if you think a little further, you will realize that the constraint does not have to be.

Kirby will of course work if you remove this constraint smartly.

Kirby’s current approach assumes that one of the content pages is also the home page.

But this is not the case in my application.

All the top-level pages are pages, but none of them is the home page. There should be a prefixed navigation from which you can jump to the individual pages. And exactly this is unfortunately not possible at the moment because of the forced home page, because Kirby always assumes this entry page as one of the content pages.

What you can do, is create a virtual page via the pages extension and then set the home option page to this virtual page, which could then contain the navigation for your site.

But I don’t quite get why it matters, if you have a home page or whatever it is called, you will have to have an entry point to your site, from where all other pages are navigable, no? Or what is a

?

<?php

use Kirby\Cms\Page;


Kirby::plugin('my/plugin', [
	'pageModels' => [
		'virtual' => 'VirtualPage'
	],
	'pages' => [
		'_' => new Page([
			'slug'     => '_',
			'template' => 'default',
			'content'  => [
				'title' => 'Navigation'
			]
		])
	]
]);
    'ready' => function() {
		return [
			'home' => '_'
		];
    },
1 Like

First of all, thank you for replying to me in this thread. That makes me feel much better :slight_smile:

In this particular case, I don’t want the homepage to be one of the listed() pages. Because when the site is first called, I don’t want any of the pages configured in the panel to be displayed yet, only navigation items for each listed page at the top level.

I think I could accomplish what I have in mind if I put all the pages as subpages under a parent page. Then I could form a navigation in the parent page with each child page. But that would have the disadvantage of adding a superfluous layer in the panel. What I am trying to achieve is that I can create a parent navigation (of all listed pages) in the template if no page was selected (i.e. the / path was called). After that you should be able to call the respective pages normally.

Thank you so much for this tip!

This was exactly the solution I needed. And it shows once again the incredible flexibility Kirby offers users. Although it is the simplest CMS in the world, you can do incredibly individual things with it.