The taxonomy contains mostly 3 levels, sometimes two levels only.
Parent
Child 1
Grandchild 1
Child 2
Via path alias, the patterns create URLs like:
/parent/child1/grandchild1
/parent/child2
When I configure my views block with the logic for the grandchild and place this blog into the layout builder of the taxonomy, it's working like a charm.
Only when I hit the the URL of the child (not grandchild) I get the error:
Drupal\Core\Database\InvalidQueryException: Query condition 'taxonomy_term_field_data.name IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (line 117 of core/lib/Drupal/Core/Database/Query/Condition.php).
(which seems to make sense, since there is not 3rd component in my path - /parent/child2
)
How to "catch" the request without a 3rd component or how can I validate either component 3 or 2 (and I'd need 1 as well in some cases).
Content: Has taxonomy term ID
as a contextual filter and it works directly for all depths and even with special characters.