I am new to Drupal 7. I have a view set up at /people with the sort criteria set to a field called surname. This is working fine, listing people out alphabetically by surname.

I have tags associated with people and /people/tag/x does list out just the people with tag x (I can't remember whether I had to do anything special to get that working).

However, when viewing people/tag/x, the entries are no longer sorted by surname. I'm not sure what order they are in.

How can I get the main view sort criteria (surname here) to persist when viewing a certain tag at people/tag/x?

Here is an export of the view: http://pastebin.com/8eBSkvn7

Screenshots of view config below, after I tried to add the contextual filters suggested by awm. I have also tried changing the first tag filter to 'Content: has taxonomy term ID'. I had no contextual filters originally.

main view settings contextual filter - tags contextual filter - surname

Many thanks for your time.

  • It is better if you can export your view and post the code here or here.
    – awm
    Mar 11, 2014 at 18:17
  • Thanks for the tip awm. I have added a pastebin link to this at the end of my post.
    – Janine
    Mar 12, 2014 at 9:07

2 Answers 2


Your view at /people/tax/%tid is probably from the default taxonomy module. No matter how much you change your /people view, that one won't change this way.

What you need to do is enable the /taxonomy/term/% view (comes disabled by default), which overrides and mimics the default taxonomy display functionality. Now you can change the view to sort to your liking.

There is a complication here however (which you might not need to worry about). This view is used for ALL taxonomy pages (all vocabularies), it is just showing any content tagged with those tags. If you start using those tags for other content (it will start showing that content alongside the people) or if you want to show content the same way for another vocabulary, you will run into the problem that both are output through this view.

To overcome this limitation, you can use the Taxonomy Views Integrator module, which allows you to specify a view for each vocabulary. Details from project page:

The TVI (Taxonomy Views Integrator) module allows selective overriding of taxonomy terms and/or vocabulary with the view of your choice. Using TVI you can easily create custom views to output all terms in X vocabuarly.

TVI will try not to interfere with views or taxonomy/term page displays if no TVI views exist for the current page request.

Good luck!

  • Thank you so much for explaining this. The tag sorting is working now and I may well have need for that TVI module. Big relief to have this working!
    – Janine
    Mar 14, 2014 at 10:14
  • It won't let me award the bounty for 7 hours so I've made a note to do this later thanks
    – Janine
    Mar 14, 2014 at 10:24

You can add another argument/contextual filter (surename). And in the contextual filter settings you could specify the sort criteria when the filter is not in URL. You can choose the sort criteria numeric or alphabetical as in the screen shots enter image description here

Then enter image description here

Edit: If you have a content type called directory, and the content type has taxonomy term reference and a field called surname you can replicate the config in the screen shot below and it should work. Note contextual filter and sort criteria settings: 1. Page View config note: enter image description here 2. Contextual filter taxonomy tag settingsenter image description here 3. How the it will display the summary: enter image description here 4. How it will display the content, note how it is sorted by surname enter image description here

  • Thanks for the screen shots but unfortunately this did not work for me. It messed up the appearance of the full list at /people (it just listed out the node titles) and left the /people/tag/x view unchanged (looking correct but still not sorted by surname)
    – Janine
    Mar 12, 2014 at 9:02
  • Your contextual filter should be tag and underneath it surename. Please do this then take a snapshot of the config.
    – awm
    Mar 12, 2014 at 14:31
  • I had no contextual filters originally, and after your first answer I had just added 1 surname one. I have now tried adding 2 filters: first a tag one and then the surname one. This did not mess anything up, but it has made no difference - output is the same as when I have no contextual filters at all. I've added screen shots of the config to my original post. Thanks.
    – Janine
    Mar 13, 2014 at 9:40
  • I have also tried changing the first tag contextual filter to 'Content: has taxonomy term ID'.
    – Janine
    Mar 13, 2014 at 10:52
  • I updated my answer, I am assuming you have a content type called directory and it has a text field surename and a taxonomy reference field. Look at the configs and results in screenshots.
    – awm
    Mar 13, 2014 at 19:37

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.