How to create a new page “type” without interacting with the content dir?

Hi,

i started using kirby CMS first on a customer project and know want to create the first by myself with your wonderful CMS.

But i got a little pain-point here.

I came across several explanations in your documentation:

and YT videos (no links as i am as a new user just allowed to paste max 2 links):

  • https:// youtu.be/ yK3gNjWU_5s?list=PLTep5U-3mg9EfgnQ08XDRs4vSOmhw2JWz&t=294
  • https:// youtu.be/ zUPqqrhbcR8?t=371

But i am a little confused about creating new page “types“ (types, i call them).
I think it’s comparable with WordPress custom Post Types.
So it’s not about creating pages on existing page “types“ manually via file or via editing in panel.

Let’s assume i do follow that example blueprint approach for the events https:// getkirby .com/docs/reference/panel/samples/events
Where it is about setting up the pages/events.yml, sections/events.yml , pages/event.yml and the template for FE output only templates/events.php

and there is a note telling me:

Note that for the example to work, a page with the slugevents needs to exist and have an events.txt file inside. Make sure that this events page is not in draft state anymore, otherwise the site.find("events") query won’t be able to find it. For a draft, you could change the parent query to kirby.page("events").

Which means i always need to interact inside /content dir when developing a new page “type”.

Which brings me to my pain-point: wanting to have a proper deployment flow probably with git versioning without touching content.
Where there is also already quite a few discussions on the forum (no links as i am as a new user just allowed to paste max 2 links):

  • https:// forum.getkirby .com/t/ versioning-in-github-the-content-folder/30641/4
  • https:// forum.getkirby .com/t/ should-content-folder-be-tracked-on-git-repository/3024/7
  • https:// forum.getkirby .com/t/ deployment-flow-for-a-kirby-site-and-to-git-the-content-or-not/20065/2
  • https:// forum.getkirby .com/t/ working-with-git-on-kirby-projects-doubts/7281

So means without adding a base page in content dir it’s not possible in panel to create pages.
Because panel always displays that warning like:

The page “events” cannot be found

Do I understood that right?

I will be very glad if that could get confirmed or may I miss a crucial detail here.
(May there is already a discussion about that on the forum i did not found so far.)

Thanks and kind regards,
André Kelling

I think you are talking about templates and blueprints. Templates define how a page is rendered to your site visitors in the frontend, blueprints define how that page looks in the Panel backend to be edited. Often, there is both a blueprint and a template with the same name belonging to the same “type”.

Which of these is used for a page is determined by the name of the .txt file inside the folder for the page inside /content. E.g. /content/test/sample.txt would create a page accessible at the URL path /test/ of your site which uses the blueprint and template named sample.

You can create blueprints and templates without having to create a page inside the content folder, in general. But of course then those don’t exist in reality on your site until you use them with one of your pages.

You are seeing this error though, because one of your blueprints specifically refers to an existing page called events. And if then this one does not exists, the error is thrown. This is what the note you quoted is about.

To add to this, to create a page with this new blueprint/template via the Panel, you need a pages section that allows creating pages with this specific template. See template and create props of pages sections in the docs: Pages section | Kirby CMS

@distantnative @texnixe

Okay thanks you both.
It all makes sense.

What I understood is still: I need a “base” page in /content dir set up. Before i can interact in the panel and create a first page.

The home and the error page must always be present (Kirby throws an error if these are missing), and are included if you start with the Starterkit or Plainkit.