5

I have substituted my frontpage with a view at http://example.com/frontpage.
I use it with two exposed filters: country and city. The current url format (http://example.com/frontpage?country=us&city=New York) is not too much SEO friendly.

What I would like to use is http://example.com/frontpage/us/New-York.

How do I do it with Views and Drupal 7?

1 Answer 1

7

You're nearly there, but you need to replace your exposed filters with equivalent Views arguments (i.e. Country and City). Then if you change the view's 'page' display path from frontpage to frontpage/%/%, each percent will be mapped to the arguments in the order they appear.

Once the above is done you can still use exposed filters for other fields to control the view, but they will need to be other for fields. If you need to change the city/country arguments inside the %, look into making a 'Jump menu' view display to provide a drop-down to control the view, rather than an exposed filter. Also see the Jump module.

If you need more power, a related alternative is to re-create the page in Panels which will allow you to pass arguments to several views in different panes at the same time. Views should do the job on its own for you, though.

3
  • I would like to do this with Views only if possible, ie. w/out Panels. The problem I have with the %/% solution is that frontpage/%/% doesn't work well when exposed filter criteria=contextual filters or I did something wrong... I will check this out again.
    – LLub
    Commented Jan 2, 2012 at 19:24
  • Don't worry about panels if you don't want them, that's just the next level of power/control... The above answer will put your key variables inside the path as arguments as requested. You can still use exposed filters to further modify the view if needs be -- keep trying, you're nearly there... Commented Jan 3, 2012 at 11:39
  • Answer updated for clarity and to handle your new queries... Commented Jan 3, 2012 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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