2

I have a url structured as such:

http://www.example.com/blog/unimportant-term/taxonomy-term

(is it a term or alias when the - dash has been added?)

I need to filter my result set based on the taxonomy term, and I don't know how to set that up in my view arguments.

Basically my view is getting all my blog posts, and depending on if there's a taxonomy term present, it will use that argument to filter the posts.

1

That should be rather easy. You have to use two arguments, a regular taxonomy argument for your important term, and the global "Null argument" to ignore the unimportant term. The null argument is added the same way as all other arguments, just have a look through the list.

I assume you know, that you have to set-up a "page" display, specify a path and insert the argument placeholders.

  • also, you might have to jigger around the convert dashes to spaces and case conversion type stuff in the argument setup to match yours, eg, a taxonomy term of "Top 40" might be top-40 in your path. – Jimajamma Dec 16 '11 at 3:08
1

I suspect you have run into a problem I tried to tack involving multiple word taxonomy terms. The url needs dashes since spaces do not work well in all browsers. But the taxonomy term does not have dashes. To set up your View and read the path segment as a term do this:

  1. Set up a view with a path like this example.com/something/something/%/something The path should not match the url format you are using to name your blog entries. That is because a view is not intended to intercept a URL, the path in the view is the path to the view and should be unique.
  2. Set the fields and filter the view to limit the display to blog content and/or whatever else you want.
  3. Create a contextual filter for a taxonomy term. In the section When the filter value IS in the URL or a default is provided check Specify validation criteria, select the vocabulary from the drop down, and from Filter Value Type select term name converted to term ID. Then check Transform dashes in URL to spaces in term name filter values

That should give you a contextual filter that reads the '%' position of the URL and displays content accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.