Set Up Route to Template - then variable Entry is undefined I've got a blog listing channel set up where I'm trying to filter entries listed by the entries field blogAuthors based on url segment.

/articles-and-excerpts/ loads the blog fine

added a route



but when I go to a page like this /articles-and-excperts/author/john-doe I see errors until I add this to the template

{% if entry is not defined %}
    {% set entry = craft.entries.section('blogListing').one() %}
{% endif %}


Then it works correctly. Why doesn't Craft recognize that this is the blogListing channel?

Also even though this works and displays the content SEOmatic doesn't recognize it now either.

Ultimately I need the following to load on this template:

/articles-and-excerpts/
/articles-and-excerpts/author/author.slug
/articles-and-excerpts/category/category.slug
/articles-and-excerpts/category/category.slug/author/author.slug

Currently I have categories using a separate template but haven't attempted to add in the author filtering.

Is there a better approach to this? I had started trying to combine url segments and a query string, but got stuck there as well Filtering entries by category and author channel
Variables like entry are only auto-injected for routes that match the Section's Site Settings routes:



If you're using custom routes, they won't match, and you'll need to set entry (or whatever) yourself manually. SEOmatic uses the same Craft mechanism for recognizing injected entrys (or whatever), so the same applies there. Vide: Rendering Metadata From Another Route