# Issue with fetching cover image thumbnails from children pages

**URL:** <https://forum.getkirby.com/t/issue-with-fetching-cover-image-thumbnails-from-children-pages/21301>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 21, 2021, 6:32pm UTC](https://forum.getkirby.com/t/issue-with-fetching-cover-image-thumbnails-from-children-pages/21301 "2021-02-21T18:32:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![denkstream](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/denkstream/32/6628_2.png) [@denkstream](https://forum.getkirby.com/u/denkstream)\
**Post date:** [February 21, 2021, 6:32pm UTC](https://forum.getkirby.com/t/issue-with-fetching-cover-image-thumbnails-from-children-pages/21301/1 "2021-02-21T18:32:19Z")

</div>

Hello everyone,

I got an issue with displaying “cover” thumbnails from single projects, I have a projects.yml blueprint containing overview of single projects (project.yml):

```
....  
  drafts:
    extends: sections/projects
    headline: Entwurf
    status: draft

  unlisted:
    extends: sections/projects
    headline: Vorschau
    status: unlisted

  listed:
    extends: sections/projects
    headline: Veröffentlicht
    status: listed
    size: medium
    layout: cards
...

```

section/projects.yml looks like this:

```
type: pages
headline: Projekte
parent: kirby.page("projekte")
info: "{{ page.published }}"
template: project
empty: Keine Projekte
sortBy: date desc
image:
query: page.cover
cover: true
ratio: 3/2

```

project.yml is blueprint with single project, it looks something like this with cover field:

```
....      
sidebar:
    width: 1/3
    sections:
      cover: fields/cover
....

```

fields/cover.yml looks like this:

```
type: files
headline: Cover
layout: cards
info: "{{ file.dimensions }}"
template: cover
min: 1
max: 1

```

As said, while in panel using project.yml cover field works great, I somehow can’t get thumbnails from project.yml to be shown in projects.yml page. What have I done wrong, I thought page.cover from section/projects.yml would fetch the cover field from project.yml and fields/cover? 🙂

---

<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 21, 2021, 6:36pm UTC](https://forum.getkirby.com/t/issue-with-fetching-cover-image-thumbnails-from-children-pages/21301/2 "2021-02-21T18:36:00Z")

</div>

What you created is a section, not a field. How are to trying to fetch this cover image in your template?

---

<div class="post-metadata">

**Author:** ![denkstream](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/denkstream/32/6628_2.png) [@denkstream](https://forum.getkirby.com/u/denkstream)\
**Post date:** [February 21, 2021, 6:41pm UTC](https://forum.getkirby.com/t/issue-with-fetching-cover-image-thumbnails-from-children-pages/21301/4 "2021-02-21T18:41:27Z")

</div>

I was using this in template

```
<?php foreach ($page->children()->listed() as $card): ?>
      <a href="<?= $card->url() ?>">
        <?php if ($cover = $card->images()->findBy("template", "cover")): ?>
      <img src="<?= $cover->url() ?>">
      <?php endif ?>
   <?php endforeach ?>

```

edit:  
If there is a more elegant solution, I’d gladly accept it 😃

---

<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 21, 2021, 7:25pm UTC](https://forum.getkirby.com/t/issue-with-fetching-cover-image-thumbnails-from-children-pages/21301/5 "2021-02-21T19:25:14Z")

</div>

That code should actually work, unless the template information is for some reason missing from the file metadata (because you added the template later…).

> [@denkstream](#):
>
> If there is a more elegant solution, I’d gladly accept it

Perfectly fine.

If I were you, I’d move the files section definition into `/site/blueprints/sections` instead of fields and change the reference accordingly, so as not to get confused in the future.

---

<div class="post-metadata">

**Author:** ![denkstream](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/denkstream/32/6628_2.png) [@denkstream](https://forum.getkirby.com/u/denkstream)\
**Post date:** [February 24, 2021, 9:15am UTC](https://forum.getkirby.com/t/issue-with-fetching-cover-image-thumbnails-from-children-pages/21301/6 "2021-02-24T09:15:56Z")

</div>

Thank you for the suggestion of putting it in sections!

I’ve solved my problem above - the file blueprint was missing. Now everything works fine, my mistake - sorry.
