Showing Entries based on an Entries Field but also showing a slug in the url I have a Channel 'Articles' with an Entries field which is linked to entries in 'Staff Members' channel.  This is so that articles can be assigned to different members of staff.

I have the generic listing (all articles) page working fine I just need to show the same page but filtered by a selected staff memeber. E.g. When viewing an individual article by a member of staff I would like to link to a page which only lists the articles assigned to that particular staff member.  This far would be ok but if possible I would also like to get the staff member name into the url... http://mysite/staff/joe-bloggs/articles

Any suggestions?

Many thanks
Set up a custom route in config/routes.php so that that URI points to your existing listing template:

return [
    'staff/&lt;route_staffMember&gt;/articles' =&gt; ['template' =&gt; '_listings/default'],
];


Then simply use the relatedTo parameter to alter which entries get listed. The template will have access to a variable called route_staffMember which you can use to fork logic between the filtered/non-filtered views. (I like to prefix these variables with route_ because when I look at the code 6 months later I always scratch my head wondering where this magic variable is being set!)

For example:

_listings/default

{% set staffMemberId = route_staffMember is defined ? craft.entries.section('staff').slug(route_staffMember).ids() : null %}
{% set entries = craft.entries.section('articles').relatedTo(staffMemberId).all() %}

{# ...or, if you're using pagination: #}
{% paginate craft.entries.section('articles').relatedTo(staffMemberId).limit(12) as pageInfo, entries %}