Filtering Pages Categories [Taxonomies] when using Gutenberg / Tera

I have recently discovered Gutenberg and Tera (Rust frameworks for static-gen websites) and found it amazing.

I'm trying to filter only specific categories pages to display upon different section on the same page. To illustrate, I wrote some code like this:

<div class="content">
    {% block content %}
    <div class="list-posts">
        {% for page in section.pages %}
        {% for key, taxonomy in page.taxonomies %}
        {% if key == "categories" %}
        {% set categories = taxonomy %}
        {% for category in categories %}
        {% if category == "rust" %}
        <article>
            <h3 class="post__title"><a href="{{ page.permalink }}">{{ page.title }}</a></h3>
        </article>
        {% endif %}
        {% endfor %}
        {% endif %}
        {% endfor %}
        {% endfor %}
    </div>
    {% endblock content %}
</div>

There should be MULTIPLE sections of the code above for different categories, eg. "rust", "java", etc.

I wrote the code to explain my question, but it isn't the way I want it (and it doesn't work when the sections are duplicated). The filtering of the particular category should be done upon the beginning when the sections/pages are loaded. How do I do that? Thanks!