How to setup view to filter based on second URL parameter? We have a view, myview, that is added to the https://www.adomain.com/some-page/ page. It has an exposed filter, Topic that a person can use to filter the user where Ajax = Enabled so that it loads the results without refreshing the page.

The view is added to a landing page (content type = basic) and at the bottom of the page. It is meant to return nodes where topic tag value is equal to what is supplied from the url. 

Taxonomy term values (topic):


IoT
Cloud
Cloud Security


How to setup view to filter based on second URL parameter?

Expected behavior:


Display all items when https://www.adomain.com/some-page/ is loaded.
Display all items where topic = Cloud Security when https://www.adomain.com/some-page/cloud-security is loaded
Display all items where topic = Cloud when https://www.adomain.com/some-page/cloud is loaded 


Current Behavior:


Displays all items when loading https://www.adomain.com/some-page/
Displays no items when loading https://www.adomain.com/some-page/cloud


What we have tried using block display type:


Create view using block display type with a contextual filter Content: topic
When filter value is not available = Display all results for the specified field
When the filter value is available or a default is provided is set to Specify Validation Criteria = enabled, Validator = Taxonomy Term Name, Vocabulary = topic, and Action to take if filter value does not validate = Display all results for the specified field


What we tried using Page display type:




add path /some-path (without %)
Add relationship, field_topic: taxonomy term and require relationship = true
Add contextual filter: Name from Taxonomy term (field_topic) with the following settings below.


Contextual filter settings:



When the filter value is not in the URL


Display all results for the specified field






When the filter value is in the url or a default is provided


Specify validation criteria = Validator = Taxonomy term name
Vocabulary = Topic
Transform dashes in URL to spaces in term name filter values = true
Action to take if filter value does not validate = Display a summary
Case = Lower case
Case in path = lower case
More = Transform spaces to dashes in url = enabled
Content Views don't have access to Taxonomy term name information out of the box, you only have term ID available. So even if you add the Taxonomy term field as the contextual filter and set the Validator = Taxonomy Term Name you're not telling it what to use, you're basically making a mistake trying to use that validator. 

You can test this if you enter the term ID into the Preview instead of the name, or set the Action to take if filter value does not validate to Display a Summary and see what you get as output ;) 

Add term name info through Relationship

To introduce the term name information into your content views you have to: 


add a Relationship to the term: Taxonomy term referenced from field_topic. Require it if you only want to list nodes that have a topic assigned.  

Now you will see a new Category of fields when adding Contextual filters: Taxonomy term
Add the Contextual filter Name from Taxonomy term Category, it will use the Relationship from previous step by default, and configure it:
When filter value is not available
Display all results for the specified field
When the filter value is available or a default is provided
 Specify validation criteria
Taxonomy term name
[Case settings, other relevant config as you see fit]


You will now see all results when visiting the main path, and if you visit the path with topic name appended the list will be filtered to show only nodes with that topic. 



In case you have terms with the same name accross vocabularies

There is a bug that kicks in sometimes  when using term name as the Validator, if you have different terms with the same term name: TermName views argument_validator is not working as expected. 

The patch from that issue is working, as reported by the question author usernameabc, so it can be used until a new version is released that includes it.