# Querying pages by template does not show any pages

**URL:** <https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 17, 2022, 2:50pm UTC](https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754 "2022-02-17T14:50:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![trych](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@trych](https://forum.getkirby.com/u/trych)\
**Post date:** [February 17, 2022, 2:50pm UTC](https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754/1 "2022-02-17T14:50:18Z")

</div>

Hi there,

I have a pages field in my `site.yml` blueprint, where I would like to be able to choose pages with the `article` template. I tried to set this up, but it does not let me select any pages. The article pages are actually two levels down, so I thought this should work via querying the `site.index`.

Here is my pages field:

```yml
featured:
  label: Featured
  type: pages
  layout: cards
  query: site.index.filterBy('template', 'article')

```

There _are_ listed pages with the article template (see screenshot):

 ![20220217-154820_Screenshot_SublimeText](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/d/d38cd09d4522d7ec69c756ee3cebd70928a257fb.png)

yet, when I click the add button on the pages field, it tells me there is no pages:

 ![20220217-154935_Screenshot_folgen.test](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/2/297a738dd5578570cb7a8a4df7ea1e7ec787b311.png)

Is there something else I am missing?  
This is in Kirby 3.6.2

Thanks!

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 17, 2022, 4:45pm UTC](https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754/2 "2022-02-17T16:45:00Z")

</div>

To be able to filter by template, the template has to actually exist in the `/site/templates` folder. Otherwise use `intendedTemplate` instead.

---

<div class="post-metadata">

**Author:** ![trych](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@trych](https://forum.getkirby.com/u/trych)\
**Post date:** [February 17, 2022, 5:41pm UTC](https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754/3 "2022-02-17T17:41:42Z")

</div>

Oh my, I thought I was going crazy here. Thanks a lot, that was it.  
Also, I finally understand what `intendedTemplate` is supposed to mean.

---

<div class="post-metadata">

**Author:** ![ff3300](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ff3300/32/3021_2.png) [@ff3300](https://forum.getkirby.com/u/ff3300)\
**Post date:** [March 2, 2022, 12:08pm UTC](https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754/4 "2022-03-02T12:08:26Z")

</div>

hi @texnixe, i have the same problem, but in this case i have the files in the template directory.  
i am upgrading an old kirby 2 to kirby 3, i used the script to optimize the name of folders in /content, and everything was ok.

When i was starting to “re-organizing” blueprints, i made a new site.yml with this code:

```auto
sections:
  #
  pages:
    headline: Pagine
    type: pages
    templates: 
      - home
      - about
      - works
  #
  pages__utility:
    headline: Pagine di servizio
    type: pages
    template: error

```

i have already put error.php and home.php in /site/templates folder, but i cannot view the pages in panel…

 ![Schermata 2022-03-02 alle 13.07.59](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/3/3020592b29a0a012abed90f9276bdda0da60aafb.jpeg)

But if i try to create a new page, then the templates i can use are the right ones [so the problem it’s that i cannot view the existing pages].

 ![Schermata 2022-03-02 alle 13.29.15](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/e/ed817f013fe392ded99cdcbe5741eb66fd67c71a.png)

If i try to create a page with the name of the template then the panel display this message [that means the pages already exist, but i cannot view them…]:

 ![Schermata 2022-03-02 alle 13.34.19](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/3/30092d7fbb887811b3b88114ae7e596fd437b4a0.jpeg)

Can anyone help me?

ps: i tried also this, but it doesn’t work too:

`query: site.index.filterBy('template', 'home')`

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [March 2, 2022, 12:45pm UTC](https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754/5 "2022-03-02T12:45:47Z")

</div>

Could you please post the complete site.yml, there seems to be something wrong.

---

<div class="post-metadata">

**Author:** ![ff3300](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ff3300/32/3021_2.png) [@ff3300](https://forum.getkirby.com/u/ff3300)\
**Post date:** [March 2, 2022, 12:54pm UTC](https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754/6 "2022-03-02T12:54:56Z")

</div>

Sure:

site.yml

```auto
title: FF3300
unlisted: true

tabs:
  #
  pages: tabs/site__pages
  #
  data_utility: tabs/site__utility

```

/tabs/site\_\_pages.yml

```auto
label: Pagine
icon: globe

sections:
  #
  pages:
    headline: Pagine
    type: pages
    templates: 
      - home
      - about
      - contact
      - spin-off
      - works
      - clients
      - people
  #
  pages__utility:
    headline: Pagine di servizio
    type: pages
    templates:
      - search
      - error
      - default
      - policy

```

/tabs/site\_utility.yml

```auto
label: Utilità
icon: cog

sections:
  #
  data_utility:
    headline: Utilità dati
    type: fields
    fields:
      #
      ## Loghi
      #
      site__headline:
        label: Site management
        type: headline
      #
      logo:
        label: Logo Header
        type: files
        max: 1
        help: Carica qui il logo in formato .SVG
      #
      menu:
        label: Seleziona le pagine da includere nella barra del menù (e nel footer)
        type: pages
        width: 1/2
      #
      social:
        label: Indica qui i social
        type: structure
        width: 1/2
        fields:
          url:
            label: Url
            type: url
            width: 1/2
          logo:
            label: Logo (formato .SVG)
            type: files
            max: 1
            width: 1/2

```

---

<div class="post-metadata">

**Author:** ![ff3300](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ff3300/32/3021_2.png) [@ff3300](https://forum.getkirby.com/u/ff3300)\
**Post date:** [March 2, 2022, 1:09pm UTC](https://forum.getkirby.com/t/querying-pages-by-template-does-not-show-any-pages/24754/7 "2022-03-02T13:09:24Z")

</div>

Solved, was a multi-language problem, because the old site was with 2 languages active, and the new K3 site was with just one. Setting the right languages everything is ok.

Solved!
