When in combination with sections?

I have categories in my blueprint (oilpainting, works on paper, photography) and below mostly albums (landscape, portraits, abstract). But sometimes a categorie has only images.
I can make 2 different sections: one with type ‘pages’ and another with type ‘files’.
I can show one of them depending on another panelfield in combination with a when clause:

sections:
work:
type: pages
label: Albums
size: small
info: “{{ page.images.count }} image(s)”
layout: cards
template: album
when:
alleenfotos: nee

But what I firstly had was:

sections:
work: sections/albums

What I want is:

sections:
work: sections/albums
images: section/album

and showing work or images depending on a condition. Is that a possibility?
In that case I have the advantage of keeping my blueprint clean and has reusable sections.

Assuming your when is not in the sections:

sections:
  work: 
    extends: sections/albums
    when: 
      allenfotos: no
  images: 
    extends: section/album
    #...

Please properly indent your code examples and use three backticks before and after the code block to mark up the code and for better readabililty. Thanks.

three-backticks-76x76

I did intend properly. I missed the possibility of extending! Thanks!
I found the way to calculate the amount of images in the category by extending the CategoryPage:

public function aantal()
    {
				if (!$this->children()->images()->isEmpty()) :
					$aantal = $this->children()->images()->count();
				else :
					$aantal = $this->images()->count();
				endif;	

        return $aantal;
    }	

and using the page.aantal in the info field: info: " {{ page.aantal }} image(s)"

What I meant is to properly post your code so that is becomes readable. For this purpose, please wrap your code always as shown in the image I posted above. Three backticks on a new line followed by your code starting on a new line, then again three backticks on a new line.

Thanks for the explanation! Your are always so helpfull! :blush: