I have edited the default home page (/user/pages/01.home) and changed the page file into "Modular".
Under the home page, I've created a new modular page called "Categories" (/user/pages/01.home/_categories).
Under the categories page, I've added another modular page, where each modular page has a taxonomy like "Term 1", "Term 2", "Term 3", "Term 4" and so on.
I've created a *.html.twig to print those content.
Now, how can I find the categories used and group them based from their taxonomy terms? Also, I would like to add the category itself as a title on each group.
This is what I've got so far (which I found in the documentation), and I've wanted to find the categories dynamically instead of typing them one by one just to find and print the taxonomy associated with it.
{% for post in taxonomy.findTaxonomy({'category':['Term 1']}) %}
{{ post.title }}
{{ post.content }}
{% endfor %}
{% for post in taxonomy.findTaxonomy({'category':['Term 2']}) %}
{{ post.title }}
{{ post.content }}
{% endfor %}
{% for post in taxonomy.findTaxonomy({'category':['Term 3']}) %}
{{ post.title }}
{{ post.content }}
{% endfor %}
{% for post in taxonomy.findTaxonomy({'category':['Term 4']}) %}
{{ post.title }}
{{ post.content }}
{% endfor %}
---