Confusion about sections/pages (events example)

I’m trying to recreate the example from the Events example: https://getkirby.com/docs/reference/panel/samples/events

I’ve created the corresponding files as per the sample:

  • /site/blueprints/pages/events.yml
  • /site/blueprints/sections/events.yml
  • /site/blueprints/pages/event.yml

Am I correct that I would then need to create a page through the panel that uses the Events template to see the corresponding panel view as per the example?

In doing so, I see the following when loading the Events page in the panel:

The section “drafts” could not be loaded: The parent for the query “site.find(“events”)” cannot be found in the section “drafts”
The section “unlisted” could not be loaded: The parent for the query “site.find(“events”)” cannot be found in the section “unlisted”
The section “listed” could not be loaded: The parent for the query “site.find(“events”)” cannot be found in the section “listed”

The Events page that I create is also uneditable, and can only be deleted through the filesystem. Just curious if I’ve misunderstood something here?

That happens because the events page is still a draft and should go away if you publish it. Or you would have to change the parent query to:

kirby.page("events")

instead of

site.find("events")
1 Like

Ah okay thank you @texnixe that worked! So I suppose the correct way to do this is to create the page in the filesystem outside the panel instead right? As the panel would create a draft by default (as its state is not editable due to the blueprint query?)

You can do that, and it usually makes sense if you want to query a particular page that it exists before you query it. However, to be on the safe side when a user accidentally turns the page ainto a draft, using the alternative query syntax is less confusing, I think.

I just tried the Events Example and get the same problem.

The section "drafts" could not be loaded: The parent for the query "kirby.page("events")" cannot be found in the section "drafts"

There is no way for me to publish this page. All change status dialogs are greyed out.

my hack
In events.yml I changed site.find(“events”) into kirby.page("events") and it did not work.
When I changed (in the file events.yml) drafts, listed and unlisted into ‘my drafts’, ‘my listed’, ‘my unlisted’ I could add an event.

events.yml

mydrafts:
  extends: sections/events
  headline: Unpublished events

myunlisted:
  extends: sections/events
  headline: Unlisted events

mylisted:
  extends: sections/events
  headline: Published events

Am I doing something wrong here?
What can I change so this works in line with the Events Example.

I am using the Maegazine example as a base. And I had to change the site blueprint: I deleted the create: default in order to be able to create Event Pages.

thx, René

It should work exactly as described, with the only difference that the parent page is not found when using the code from the reference when the events parent page is in draft mode. Therefore you had to make the change from site.find('events') to kirby.page('events').

The status of the parent page cannot be changed because of this setting in events.yml status: false. You can of course change this.

It’s not a problem, but maybe you want to know this:
I tried both site.find(‘events’) and kirby.page(‘events’) and both gave the same (error) result.

I actually tested the example, and it worked as described apart from the parent option which had to be changed as mentioned because of the draft state. So I wonder what you did differently. Note that the example requires preset: pages to work.

I cannot find the problem, so I will reinstall Kirby and the Events example.
Thank you for taking the time to check this!

René