Creating panel to manage a page with item/content within multiple subfolders

Hi, I’m currently building my first Kirby website.

I have an “About” page that will show these:

  1. A list of team members
  2. A list of partners

All items within these lists will not have their own page, but it will be displayed on their own section within the About page.

My current idea is each item will be stored within subfolders:

About/
├─ members/
│  ├─ Person 1/
│  ├─ Person 2/
│  ├─ ...
├─ partners/
│  ├─ Company 1/
│  ├─ Company 2/
│  ├─ ...

In the “About” panel, these 2 sections are currently separated using tabs.

# about.yml
tabs:
  members:
    sections:
      members: 
        type: pages
        parent: kirby.page("about/members")
        template: members
  partners:
    sections:
      partners:
        type: pages
        parent: kirby.page("about/partners")
        template: partners

Later when the website goes live, the Editors should add/edit any Members and Partners through these tabs. I may also add another tab (ex: “Page setup”) so that the Editors may update any texts/images on the page.

So here’s the problem – the link to “about+members” and “about+partners” are clickable through:

  1. The panel breadcrumbs

    About / members / Person 1
    About / partners / Company 1

  2. The section’s label in each tab

Clicking the link will open a page with the default panel blueprint.

Is there any way to make it unclickable? Or maybe hide it from the breadcrumbs?

Maybe I’m not structuring the content for Kirby properly? Is there a better way to approach this? Any suggestions are also welcome.

You could use a structure field but depending on your use case pages can have advantages (uuid for example).

I think the simplest way would be to create a blueprint for the pages members and about with only a subpages section (members and partners) and maybe a link to the parent page. In case someone clicks on them, they can easily go back or to a subpage. It’s not the most beautiful solution, but the user can navigate.

You can always hide the breadcrumbs in the panel, but that removes usability.

I guess you referring to the parent pages members and partners that don’t have a specific template assigned? You could make them non-accessible in the Panel by setting the access option to false in their blueprint (would require a separate blueprint if default is used for other pages).

Oh, I tried that before and nothing happened because I forgot to write it under options: :man_facepalming:t2:

Now I did it correctly, the behaviour is kind of expected, but not something what I want the Editors to see. The link is still clickable. But upon click, Kirby will show error message “page … cannot be found”:

Screenshot

So maybe I need to rethink my approach.


Using a structured field seems to be another option. But if in the near future we wanted to have individual page for each member, I believe Kirby didn’t provide any way to display the saved structured data as a single page?

I may have some idea/workaround on how to do so, but I’ll have to code on my own.


For now, I ended up moving the “Members” & “Partners” folders to the content root. And then inside “About” panel, I linked the tab to each folder:

Summary
# about.yml
tabs:
  members:
    sections:
      member: 
        type: pages
        parent: kirby.page("members")
        template: member
  partners:
    sections:
      partner:
        type: pages
        parent: kirby.page("partners")
        template: partner

But what if, I just create both “Members” and “Partners” in one folder:

About/
├─ Company 1/
├─ Person 1/
├─ ...

I can use when: to show different fields based on selection between “Members” and “Partners”. Assuming the blueprint is something like this:

Blueprint
title: Data entry for About page
sections:
  entry:
    type: fields
    fields:
      entryType:
        label: Entry type
        type: select
        options:
          - Member
          - Partner
  entryMember:
    type: fields
    fields:
      #...
    when:
      entryType: Member
  entryPartner:
    type: fields
    fields:
      #...
    when:
      entryType: Partner

I’d like to know:

  1. Can I define a Collection based on the entryType value?

page('about')->children()....?

  1. Is there any way to prepend the entryType to the folder?

Example: partner_company_1, member_person_1

You can separate them by blueprint. User member blueprint for members and person blueprint when creating persons. So allow two templates in the section, which will allow users to choose the right one depending on what they want to create.

Then in your template, you can filter by this blueprint.

Oh wait… Isn’t that is basically what I’ve just did? I only need to update/remove the parent :man_facepalming:t2:. I can still use my “separate by tabs” idea and no need to use the conditional field.

Blueprint
# about.yml
tabs:
  members:
    sections:
      member: 
        type: pages
        template: member
  partners:
    sections:
      partner:
        type: pages
        template: partner

(I believe I didn’t misunderstand your suggestion…?)

I really shouldn’t do this at midnight, my brain isn’t braining properly… Well, at least I learned few things about the conditional fields tonight.

Thanks for the assist thus far… I’ll continue tomorrow…

A post was split to a new topic: Field validation