Relations and Categories What's given:

Channel: Nutrition
Entries Fieldtype: restaurant
Category Fieldtype : menu

Category: Menu

Channel: Menus that also use relations using restaurant field.


Each item in the nutrition channel has restaurant and menu category selected.

On a restaurant's menu page I'm trying to list menu items from the nutrition channel grouped by categories.

Currently I use the following snippet

            {% for category in craft.categories.group('menu').all() %}
                &lt;h3 id="{{ category.slug }}"&gt;{{ category.title }}&lt;/h2&gt;
                &lt;ul class="menu-items"&gt;
                    {% for entry in craft.entries.section('nutrition').relatedTo(category).orderBy('title').all() %}
                        &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
                    {% endfor %}
                &lt;/ul&gt;
            {% endfor %}


Which works fine. However if I add more nutrition items and assign them to another restaurant they'll be listed as well.

I assume we need to define restaurant first

{% set restaurant = craft.entries.section('restaurant').one() %}


but what are my next steps?
The next step is that you would need to chain .relatedTo(restaurant) to your existing craft.entries() call