Panel: Pages section – is it possible to display all pages BUT one specific one

In a pages section/list, is the following possible?

somename:
  type: pages
  status: all
  headline: Pages
  template: {{ all-pages-but-not-page-with-template-X}}

I can’t use:

templates:
  - sometemplate X
  - sometemplate Y

Because I don’t know if there will be pages – with now unknown templates – added later and therefore are currently not on the list.(for example “sometemplate Z”)

1 Like

Your question is a little ambiguous. Are you wanting to display pages in the pages section that do not have that template, or do you want limit the ability to create a page with that section, excluding a specific template?

If its a filter you want, that you can, i think, use a filter on the parent option to sift out the child pages that use a certain template, so they wont get listed in the pages section.

If you took the template option out, then i think all templates will be usable (not tried it, but K2 did that some assuming this does).

You can limit what can be added to your section with the create option. You can find this example in site.yml of the Starterkit:

    sections:
      notes: sections/notes
      pages:
        type: pages
        create: default
        template:
          - about
          - home
          - default

This means that the section displays all pages that have a template listed under template, but the user can only create new pages with the default template. The create option also accepts an array of multiple possible templates.

Also, if you limit templates in the template options, no pages with other templates can be created through this section. The create option limits this even more.

In your example above that means that only pages with the templates X and Y are displayed, but at the same time the user can’t create any templates with the template Z, so you wouldn’t have to worry about this template not showing up in the list.

2 Likes

Ahh, thanks a lot, I’ll try it out!