Exclude page template from select field

I use the select field to display a list of pages my client can link to:

  link:
    label:       Internal Link
    type:        select
    options:     query
    query:
      fetch: pages
      value: '{{uri}}'
      text: '{{title}}'

Since I use the modules plugin on this page I’ve got a lot of pages that are either modules or module containers and it looks like this:

I know you can define a template filter in the query, but can you somehow define multiple templates or even exclude templates? It seems to me like you can only define a single template.

  link:
    label:       Internal Link
    type:        select
    options:     query
    query:
      fetch: pages
      value: '{{uri}}'
      text: '{{title}}'
      template: default

Yes, you can only define a single template. An alternative would be to use the JSON API or the Controlled List plugin

Would a feature like the following make sense to have?

query:
    fetch: pages
    exclude:
        template: module

or alternatively:

query:
    fetch: pages
    template:
        - default
        - news

I’d add an issue to GitHub if this is something anyone else could benefit from. Otherwise I’ll stick to the Controlled List. Thanks @texnixe!

1 Like

I think I would prefer whitelisting multiple templates to having another option, but in general, such a feature makes sense.