Posts' categories in layout

Files cat1, cat2, … have layout set to ‘category’
In _layouts/category.html I put something like this.

{%- case page.name -%}
{%- when ‘cat1.html’ -%}
{%- assign postlist = site.categories.Category1 -%}
{%- when ‘cat2.md’ -%}
{%- assign postlist = site.categories.Category2 -%}
{%- when ‘cat3.md’ -%}
{%- assign postlist = site.categories.Category3 -%}
{%- else -%}
{%- assign postlist = false -%}
{%- endcase -%}

How to simplify this code?
Thanks!

OK, I found it:

{%- assign postlist = site.posts | where: “category”, page.title -%}

It was so simple!!!