Parent / Filter by field

Hi folks,

I’m starting to use Kirby but I’m stuck on something. I want to build a Help Section, so each question has a field for the category.

I want in the panel to show a list of articles, sub-sectioned by category. I can’t see to work it out. For instance:

label: Help
  columns:
    left:
      width: 1
        sections:
          help:
            headline: General
            type: pages
            parent: site.index.findBy("section","extension")
            sortBy: date desc

Is not working. Any idea what I’m doing wrong?

Thanks!

Michel

What is the section Parameter you are using in the findby method??

Hi

It is a field in my page blueprint. A select.

Does your query return a page that has children? The parent option expects a parent page.

What is the result? An empty section? Or an error message?

I suspect what you want to do here is filter pages with a query, but that is not possible with a standard pages section. There is a plugin that would allow you to do that, though, the Pagesdisplay section: https://github.com/rasteiner/k3-pagesdisplay-section

It returns nothing im guessing since it shows no pages. I do have a page that should match though.

I have seen the plugin but it looks like it wont allow me to have the add button on top?

That’s right, it doesn’t have an add button, the user would have to go to the parent page to add new pages.

Yes, but does that page have subpages?

A section always shows the subpages of a given parent page. You can filter those subpages by template and status, but by nothing else.

So if you want different sections for the same parent page, you would have to use different templates.

Alternatively, you could work with category parents.

Or modify the above mentioned plugin to allow adding pages.

Or use the plugin as is and add an additional section for adding new pages, filter by status to only show the new ones and once they are published, they end up in one of the filtered pages display sections.

Thanks a lot. I guess adding a section with just the add button would do.

Category parent? What do you mean?

Meaning a page structure where each of your sections/categories that you wanted to filter by has its own parent:

- extensions
   -- subpage 1
   -- subpage 2
- some other section
  -- subpage 1
  -- subpage 2

etc.

Ah yes I thought about this one. Would I be able to move from one folder to another from the panel though? But that was my initial track :slight_smile:
I know very specific

Not at them moment, according to the roadmap, moving pages is planned for 3.3, though.

As long as your list of help entries doesn’t get too long, I’d probably put them into one folder and use the plugin to filter them in the Panel.

There’s always more then one way of doing things and it depends on the use case and the user preferences what works best for them.

If lists of subpages become too long (like hundreds or thousands of pages), a tree structure can be better and more performant at the price of being less flexible (at least as long as we can’t move pages from the Panel). Also, sorting pages into category folders is not useful if a page belongs to multiple categories.

1 Like

Ah I’ll go with category parents then. Thanks a million for taking the time to help :slight_smile: