Veteran noob: I still don't understand the interaction of presets and sections and fields

I find myself very often wanting to add fields to a panel page with the “pages” preset. This is a baffling task, and I don’t understand what should go inside what section or really what the logic here is at all. In my opinion you should be able to do something as simple as this:

title: Page
preset: pages

#default pages stuff

fields:
  field1:
  field2:
  etc

To me, this should make a default pages panel, with fields below the default content. Why isn’t this possible? I still truly don’t get it after years. Using tabs is a solution, but why? I put the pages preset inside of a section, and then suddenly certain things stop working, such as the cards layout. I feel like this is some philosophical distinction which I am just not understanding. thanks!

Heres a spoiler: you dont have to use the the presets. Infact, i never do. They do have some defaults in there to get you going but i think your frustration comes from trying to use a preset + your stuff on top. The presets are well documented here Presets | Kirby CMS

Using tabs and extending blueprints is the way to go in my personal opinion. For me a default page template usually looks like this:


title:     Default

tabs:

  # CONTENT
  content: tabs/content

  # SEO
  seo: tabs/seo/meta

  # PAGE FILES
  files:   tabs/files

Thats it. The tabs have the required sections etc inside them. So, for example, my basic content tab looks like this

label:              Content
icon:               text

columns:
  # CONTENT
  left:
    width:          3/3
    sections:
      # FIELDS
      content:
        type:       fields
        fields:
          pagetext:
            label:  Content
            type:   textarea

If i need something else, i just clone it, add the extra fields, and load that into the template as needed.

I do have a github repo that has a super simple example of this in action. Its just the Kirby Plain kit with a couple of extra blueprints and i use this as a base for every website i make.

Tabs are amazing because you can keep a library of them and just plug in them in out as required. You can even set them up in a plugin so that you can easily share them across projects.

3 Likes

I agree with @jimbobrjames. I never use the presets, apart from maybe setting something up real quick for testing that doesn’t need any custom stuff.